svn commit: samba r2535 - in branches/SAMBA_4_0/source/libcli/util: .

abartlet at samba.org abartlet at samba.org
Wed Sep 22 21:50:50 GMT 2004


Author: abartlet
Date: 2004-09-22 21:50:49 +0000 (Wed, 22 Sep 2004)
New Revision: 2535

WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_4_0/source/libcli/util&rev=2535&nolog=1

Log:
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

Modified:
   branches/SAMBA_4_0/source/libcli/util/asn1.c


Changeset:
Modified: branches/SAMBA_4_0/source/libcli/util/asn1.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/util/asn1.c	2004-09-22 21:45:52 UTC (rev 2534)
+++ branches/SAMBA_4_0/source/libcli/util/asn1.c	2004-09-22 21:50:49 UTC (rev 2535)
@@ -566,7 +566,13 @@
 	*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)



More information about the samba-cvs mailing list