mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
libseckey: Fix integer underflow for malformed SPKIs
When the BER encoded BITRSTRING field has a zero length, then skipping the unused-bits byte that a BITRSTING normally contains will cause a underflow and thus may cause an out of bounds read by the caller of sk_ep11_parse_spki(). Assisted-by: IBM Bob:2.0.0 Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com> Reviewed-by: Finn Callies <fcallies@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
5ab3473442
commit
220f51fb98
@@ -504,6 +504,8 @@ static int sk_ep11_parse_spki(const unsigned char *spki, size_t spki_len,
|
||||
pub_key, pub_key_len);
|
||||
if (tag != 0x03) /* BITSTRING */
|
||||
return -EINVAL;
|
||||
if (*pub_key_len == 0)
|
||||
return -EINVAL;
|
||||
|
||||
/* skip unsused-bits byte */
|
||||
(*pub_key)++;
|
||||
|
||||
Reference in New Issue
Block a user