DragonFlyBSD Kernel Audit
DF-0971 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/crypto/rc4/rc4.c b/sys/crypto/rc4/rc4.c
--- a/sys/crypto/rc4/rc4.c
+++ b/sys/crypto/rc4/rc4.c
@@ -39,6 +39,7 @@
 #include <sys/kernel.h>
 #include <sys/module.h>
 #include <sys/types.h>
+#include <sys/systm.h>
 #include <crypto/rc4/rc4.h>
 
 static __inline void
@@ -60,6 +61,9 @@
 {
 	u_char j;
 	int i, k;
+
+	if (keylen <= 0)
+		return;
 
 	/* Initialize state with identity permutation */
 	for (i = 0; i < 256; i++)