Browse Source

anti-DoS rounds count limits for blowfish and des crypt

all of the limits could use review, but err on the side of avoiding
excessive rounds for now.
rs-1.0
Rich Felker 14 years ago
parent
commit
13157b025e
  1. 2
      src/misc/crypt_blowfish.c
  2. 2
      src/misc/crypt_des.c

2
src/misc/crypt_blowfish.c

@ -625,7 +625,7 @@ static char *BF_crypt(const char *key, const char *setting,
} }
count = (BF_word)1 << ((setting[4] - '0') * 10 + (setting[5] - '0')); count = (BF_word)1 << ((setting[4] - '0') * 10 + (setting[5] - '0'));
if (count < min || BF_decode(data.binary.salt, &setting[7], 16)) { if (count < min || count > 2048 || BF_decode(data.binary.salt, &setting[7], 16)) {
return NULL; return NULL;
} }
BF_swap(data.binary.salt, 4); BF_swap(data.binary.salt, 4);

2
src/misc/crypt_des.c

@ -911,7 +911,7 @@ static char *_crypt_extended_r_uut(const char *_key, const char *_setting, char
return NULL; return NULL;
count |= value << (i - 1) * 6; count |= value << (i - 1) * 6;
} }
if (!count) if (!count || count > 262143)
return NULL; return NULL;
for (i = 5, salt = 0; i < 9; i++) { for (i = 5, salt = 0; i < 9; i++) {

Loading…
Cancel
Save