r2535: Make certain, that even if we have invalid ASN.1 here, and the caller does...
authorAndrew Bartlett <abartlet@samba.org>
Wed, 22 Sep 2004 21:50:49 +0000 (21:50 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:59:03 +0000 (12:59 -0500)
Andrew Bartlett
(This used to be commit 0e081ecb9d752067b99305b3b62477c3eed9ac24)

source4/libcli/util/asn1.c

index ca62a0b57484db0100e67588929ecafc10912ffe..3dc5abc09ae18779003a9e48d2d9cdbd733fe61d 100644 (file)
@@ -566,7 +566,13 @@ BOOL asn1_read_OctetString(ASN1_DATA *data, DATA_BLOB *blob)
        *blob = data_blob(NULL, len);
        asn1_read(data, blob->data, len);
        asn1_end_tag(data);
-       return !data->has_error;
+       
+       if (data->has_error) {
+               data_blob_free(blob);
+               *blob = data_blob(NULL, 0);
+               return False;
+       }
+       return True;
 }
 
 BOOL asn1_read_ContextSimple(ASN1_DATA *data, uint8_t num, DATA_BLOB *blob)