From 5e7259a6977078b95008856a3f8986fbb99e7a1b Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 22 Sep 2004 21:50:49 +0000 Subject: 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) --- source4/libcli/util/asn1.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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) -- cgit