svn commit: samba r16208 - in trunk/source/libsmb: .

jra at samba.org jra at samba.org
Tue Jun 13 21:01:13 GMT 2006


Author: jra
Date: 2006-06-13 21:01:10 +0000 (Tue, 13 Jun 2006)
New Revision: 16208

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=16208

Log:
Ensure we don't allocate an OID string unless
we know we don't have an error. Klocwork #6.
Jeremy.

Modified:
   trunk/source/libsmb/asn1.c


Changeset:
Modified: trunk/source/libsmb/asn1.c
===================================================================
--- trunk/source/libsmb/asn1.c	2006-06-13 21:01:08 UTC (rev 16207)
+++ trunk/source/libsmb/asn1.c	2006-06-13 21:01:10 UTC (rev 16208)
@@ -340,7 +340,11 @@
 	pstring oid_str;
 	fstring el;
 
-	if (!asn1_start_tag(data, ASN1_OID)) return False;
+	*OID = NULL;
+
+	if (!asn1_start_tag(data, ASN1_OID)) {
+		return False;
+	}
 	asn1_read_uint8(data, &b);
 
 	oid_str[0] = 0;
@@ -361,7 +365,9 @@
 
 	asn1_end_tag(data);
 
-	*OID = SMB_STRDUP(oid_str);
+	if (!data->has_error) {
+	  	*OID = SMB_STRDUP(oid_str);
+	}
 
 	return !data->has_error;
 }
@@ -371,7 +377,9 @@
 {
 	char *id;
 
-	if (!asn1_read_OID(data, &id)) return False;
+	if (!asn1_read_OID(data, &id)) {
+		return False;
+	}
 
 	if (strcmp(id, OID) != 0) {
 		data->has_error = True;



More information about the samba-cvs mailing list