Enforce non-zero MPPE key length

This commit is contained in:
Jouni Malinen 2008-02-27 17:49:24 -08:00
parent eff06a7cdb
commit 380da72b80

View file

@ -803,6 +803,7 @@ static u8 * decrypt_ms_key(const u8 *key, size_t len,
ppos = plain = os_malloc(plen); ppos = plain = os_malloc(plen);
if (plain == NULL) if (plain == NULL)
return NULL; return NULL;
plain[0] = 0;
while (left > 0) { while (left > 0) {
/* b(1) = MD5(Secret + Request-Authenticator + Salt) /* b(1) = MD5(Secret + Request-Authenticator + Salt)
@ -827,7 +828,7 @@ static u8 * decrypt_ms_key(const u8 *key, size_t len,
left -= MD5_MAC_LEN; left -= MD5_MAC_LEN;
} }
if (plain[0] > plen - 1) { if (plain[0] == 0 || plain[0] > plen - 1) {
printf("Failed to decrypt MPPE key\n"); printf("Failed to decrypt MPPE key\n");
os_free(plain); os_free(plain);
return NULL; return NULL;