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

asn1: Add overflow check to asn1_write

Found by pure code reading :-)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Volker Lendecke 2015-12-22 13:50:54 +01:00 committed by Jeremy Allison
parent ad630a681e
commit 249202d8c0

View File

@ -40,6 +40,12 @@ void asn1_free(struct asn1_data *data)
bool asn1_write(struct asn1_data *data, const void *p, int len)
{
if (data->has_error) return false;
if ((len < 0) || (data->ofs + (size_t)len < data->ofs)) {
data->has_error = true;
return false;
}
if (data->length < data->ofs+len) {
uint8_t *newp;
newp = talloc_realloc(data, data->data, uint8_t, data->ofs+len);