⬢ DragonFlyBSD Kernel Audit
DF-2371 / fix.diff
← back to finding ↓ download raw
--- a/sys/crypto/twofish/twofish.c
+++ b/sys/crypto/twofish/twofish.c
@@ -430,6 +430,10 @@
     l_key = ctx->l_key;
     s_key = ctx->s_key;
 
+    if (key_len_bits != 128 && key_len_bits != 192 &&
+        key_len_bits != 256)
+        return;		/* refuse out-of-range key length */
+
     ctx->k_len = key_len_bits / 64;   /* 2, 3 or 4 */
 
     for(i = 0; i < ctx->k_len; ++i)