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

lib:addns: Don’t call memcpy() with a NULL pointer

Doing so is undefined behaviour.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Joseph Sutton 2023-05-01 11:22:02 +12:00 committed by Andrew Bartlett
parent f60249eed5
commit 2eb458118c

View File

@ -88,7 +88,9 @@ void dns_marshall_buffer(struct dns_buffer *buf, const uint8_t *data,
buf->data = new_data; buf->data = new_data;
} }
memcpy(buf->data + buf->offset, data, len); if (data != NULL) {
memcpy(buf->data + buf->offset, data, len);
}
buf->offset += len; buf->offset += len;
return; return;
} }