mirror of
https://github.com/samba-team/samba.git
synced 2025-02-04 17:47:26 +03:00
r16207: Ensure we don't allocate an OID string unless
we know we don't have an error. Klocwork #6. Jeremy.
This commit is contained in:
parent
304b7913cd
commit
2c1a2d7b40
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user