Преглед на файлове

Check key_len in secret_to_key_new()

This bug shouldn't be reachable so long as secret_to_key_len and
secret_to_key_make_specifier stay in sync, but we might screw up
someday.

Found by coverity; this is CID 1241500
Nick Mathewson преди 9 години
родител
ревизия
7c52a0555a
променени са 1 файла, в които са добавени 3 реда и са изтрити 0 реда
  1. 3 0
      src/common/crypto_s2k.c

+ 3 - 0
src/common/crypto_s2k.c

@@ -392,6 +392,9 @@ secret_to_key_new(uint8_t *buf,
   type = buf[0];
   key_len = secret_to_key_key_len(type);
 
+  if (key_len < 0)
+    return key_len;
+
   if ((int)buf_len < key_len + spec_len)
     return S2K_TRUNCATED;