1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

asn1: make readContextSimple() add a NUL byte

Pair-programmed-with: Garming Sam <garming@catalyst.net.nz>
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
This commit is contained in:
Douglas Bagnall 2016-01-11 11:36:07 +13:00 committed by Andrew Bartlett
parent 16fda12282
commit 9bbd7d1c77

View File

@ -938,12 +938,14 @@ bool asn1_read_ContextSimple(struct asn1_data *data, TALLOC_CTX *mem_ctx, uint8_
data->has_error = true;
return false;
}
*blob = data_blob_talloc(mem_ctx, NULL, len);
*blob = data_blob_talloc(mem_ctx, NULL, len + 1);
if ((len != 0) && (!blob->data)) {
data->has_error = true;
return false;
}
if (!asn1_read(data, blob->data, len)) return false;
blob->length--;
blob->data[len] = 0;
return asn1_end_tag(data);
}