Signed-off-by: Michael Brown <mcb30@ipxe.org>
/* Check and skip unused-bits byte of bit string */
bit_string = cursor.data;
- if ( cursor.len < 1 ) {
+ if ( ( cursor.len < sizeof ( *bit_string ) ) ||
+ ( bit_string->unused != 0 ) ) {
rc = -EINVAL;
goto err_parse;
}
- cursor.data++;
- cursor.len--;
+ cursor.data = &bit_string->data;
+ cursor.len -= offsetof ( typeof ( *bit_string ), data );
/* Enter RSAPublicKey */
asn1_enter ( &cursor, ASN1_SEQUENCE );