diff options
author | Jeremy Allison <jra@samba.org> | 2006-06-13 21:01:08 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:17:25 -0500 |
commit | 069397c63ead319d5e237fa1ce16714bb86fc7f7 (patch) | |
tree | 589d7a1fc9a86eb7a8df10ced4c000b7081e2270 /source3 | |
parent | 6cb8d0971018589f40d4218fe5fecbd4fc84cb92 (diff) | |
download | samba-069397c63ead319d5e237fa1ce16714bb86fc7f7.tar.gz samba-069397c63ead319d5e237fa1ce16714bb86fc7f7.tar.bz2 samba-069397c63ead319d5e237fa1ce16714bb86fc7f7.zip |
r16207: Ensure we don't allocate an OID string unless
we know we don't have an error. Klocwork #6.
Jeremy.
(This used to be commit 2c1a2d7b40e7ef353461f97f5c69c2079b5670ab)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/libsmb/asn1.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/source3/libsmb/asn1.c b/source3/libsmb/asn1.c index 86a2845192..8c986c9588 100644 --- a/source3/libsmb/asn1.c +++ b/source3/libsmb/asn1.c @@ -340,7 +340,11 @@ BOOL asn1_read_OID(ASN1_DATA *data, char **OID) 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 @@ BOOL asn1_read_OID(ASN1_DATA *data, char **OID) 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 @@ BOOL asn1_check_OID(ASN1_DATA *data, const char *OID) { 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; |