r25212: merge some stuff from samba3
authorStefan Metzmacher <metze@samba.org>
Tue, 18 Sep 2007 13:31:05 +0000 (13:31 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 20:06:54 +0000 (15:06 -0500)
metze

source/libcli/util/asn1.c

index 7e2d54fcbd8b02d9a74b7c882530deb9049f761b..f2098de5c55055ed2a8713c5fc74f4662def3e96 100644 (file)
@@ -360,6 +360,9 @@ BOOL asn1_load(struct asn1_data *data, DATA_BLOB blob)
 /* Peek into an ASN1 buffer, not advancing the pointer */
 BOOL asn1_peek(struct asn1_data *data, void *p, int len)
 {
+       if (data->has_error)
+               return False;
+
        if (len < 0 || data->ofs + len < data->ofs || data->ofs + len < len)
                return False;
 
@@ -405,7 +408,7 @@ BOOL asn1_peek_tag(struct asn1_data *data, uint8_t tag)
                return False;
        }
 
-       if (!asn1_peek(data, &b, sizeof(b)))
+       if (!asn1_peek_uint8(data, &b))
                return False;
 
        return (b == tag);