More paranoia checks.
authorJeremy Allison <jra@samba.org>
Wed, 11 Feb 2004 23:25:49 +0000 (23:25 +0000)
committerJeremy Allison <jra@samba.org>
Wed, 11 Feb 2004 23:25:49 +0000 (23:25 +0000)
Jeremy.
(This used to be commit 4920f9bd660e22c8ac3ba1c389781f2efbcd1e78)

source3/libsmb/asn1.c

index 17170b015f3017d9d21bf031f2342779c2a096b1..ecc5e3dee641b949034370d2a0c4dc975707052c 100644 (file)
@@ -219,6 +219,11 @@ BOOL asn1_load(ASN1_DATA *data, DATA_BLOB blob)
 /* read from a ASN1 buffer, advancing the buffer pointer */
 BOOL asn1_read(ASN1_DATA *data, void *p, int len)
 {
+       if (len < 0 || data->ofs + len < data->ofs || data->ofs + len < len) {
+               data->has_error = True;
+               return False;
+       }
+
        if (data->ofs + len > data->length) {
                data->has_error = True;
                return False;