diff options
author | Joseph Sutton <josephsutton@catalyst.net.nz> | 2023-05-01 11:22:02 +1200 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2023-05-05 02:54:31 +0000 |
commit | 2eb458118c3de09cea42749098df1f93dc0e9eca (patch) | |
tree | 5fed2e9db466ea0862d99f656e6e866b642eff63 | |
parent | f60249eed58d9c282b21fd83dcb0654f310ac8db (diff) | |
download | samba-2eb458118c3de09cea42749098df1f93dc0e9eca.tar.gz |
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>
-rw-r--r-- | lib/addns/dnsmarshall.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/addns/dnsmarshall.c b/lib/addns/dnsmarshall.c index 6c93b98144f..c95420304f0 100644 --- a/lib/addns/dnsmarshall.c +++ b/lib/addns/dnsmarshall.c @@ -88,7 +88,9 @@ void dns_marshall_buffer(struct dns_buffer *buf, const uint8_t *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; return; } |