pmac_init: prevent possible out of bounds access of polys[]

This commit is contained in:
Steffen Jaeckel 2014-05-25 00:28:51 +02:00
parent ea9b2a858a
commit 8652f33f35

View File

@ -63,6 +63,9 @@ int pmac_init(pmac_state *pmac, int cipher, const unsigned char *key, unsigned l
break;
}
}
if (poly >= (int)(sizeof(polys)/sizeof(polys[0]))) {
return CRYPT_INVALID_ARG;
}
if (polys[poly].len != pmac->block_len) {
return CRYPT_INVALID_ARG;
}