summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2004-09-22 21:50:49 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:59:03 -0500
commit5e7259a6977078b95008856a3f8986fbb99e7a1b (patch)
treeca1b114e2f9cb226d9531e8ff4559d97e5fc9a64
parent366be01eef961c183a3c59ddd084059378aedc27 (diff)
downloadsamba-5e7259a6977078b95008856a3f8986fbb99e7a1b.tar.gz
samba-5e7259a6977078b95008856a3f8986fbb99e7a1b.tar.bz2
samba-5e7259a6977078b95008856a3f8986fbb99e7a1b.zip
r2535: Make certain, that even if we have invalid ASN.1 here, and the caller does not check the return value, that we don't return uninitialised memory here.
Andrew Bartlett (This used to be commit 0e081ecb9d752067b99305b3b62477c3eed9ac24)
-rw-r--r--source4/libcli/util/asn1.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/source4/libcli/util/asn1.c b/source4/libcli/util/asn1.c
index ca62a0b574..3dc5abc09a 100644
--- a/source4/libcli/util/asn1.c
+++ b/source4/libcli/util/asn1.c
@@ -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)