Prevent running off the end of the buffer if the asn.1 is invalid (Chaskiel G.)
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1674 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
parent
83a5cb1426
commit
6b66973692
|
@ -311,6 +311,8 @@ const u8 *sc_asn1_find_tag(struct sc_context *ctx, const u8 * buf,
|
|||
buf = p;
|
||||
if (sc_asn1_read_tag(&p, left, &cla, &tag, &taglen) != 1)
|
||||
return NULL;
|
||||
if (left < (p - buf))
|
||||
return NULL;
|
||||
left -= (p - buf);
|
||||
if ((tag | cla) == tag_in) {
|
||||
if (taglen > left)
|
||||
|
|
Loading…
Reference in New Issue