Fix bug in get_pkcs_padding(): cannot be 0-length

This commit is contained in:
Manuel Pégourié-Gonnard 2013-07-26 10:58:48 +02:00 committed by Paul Bakker
parent a640849b55
commit b7d24bc7ca

View file

@ -546,7 +546,7 @@ static int get_pkcs_padding( unsigned char *input, size_t input_len,
padding_len = input[input_len - 1];
if( padding_len > input_len )
if( padding_len > input_len || padding_len == 0 )
return POLARSSL_ERR_CIPHER_INVALID_PADDING;
for( i = input_len - padding_len; i < input_len; i++ )