1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-23 09:57:40 +03:00

lib: util: asn1 fixes - check all returns.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
This commit is contained in:
Jeremy Allison 2014-09-19 12:39:19 -07:00
parent b6ec190e74
commit f102752b0c

View File

@ -296,23 +296,22 @@ bool unwrap_edata_ntstatus(TALLOC_CTX *mem_ctx,
return false;
}
asn1_load(data, *edata);
asn1_start_tag(data, ASN1_SEQUENCE(0));
asn1_start_tag(data, ASN1_CONTEXT(1));
asn1_read_Integer(data, &edata_type);
if (!asn1_load(data, *edata)) goto err;
if (!asn1_start_tag(data, ASN1_SEQUENCE(0))) goto err;
if (!asn1_start_tag(data, ASN1_CONTEXT(1))) goto err;
if (!asn1_read_Integer(data, &edata_type)) goto err;
if (edata_type != KRB5_PADATA_PW_SALT) {
DEBUG(0,("edata is not of required type %d but of type %d\n",
KRB5_PADATA_PW_SALT, edata_type));
asn1_free(data);
return false;
goto err;
}
asn1_start_tag(data, ASN1_CONTEXT(2));
asn1_read_OctetString(data, talloc_tos(), &edata_contents);
asn1_end_tag(data);
asn1_end_tag(data);
asn1_end_tag(data);
if (!asn1_start_tag(data, ASN1_CONTEXT(2))) goto err;
if (!asn1_read_OctetString(data, talloc_tos(), &edata_contents)) goto err;
if (!asn1_end_tag(data)) goto err;
if (!asn1_end_tag(data)) goto err;
if (!asn1_end_tag(data)) goto err;
asn1_free(data);
*edata_out = data_blob_talloc(mem_ctx, edata_contents.data, edata_contents.length);
@ -320,6 +319,11 @@ bool unwrap_edata_ntstatus(TALLOC_CTX *mem_ctx,
data_blob_free(&edata_contents);
return true;
err:
asn1_free(data);
return false;
}