mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 14:35:26 +00:00
Do not pass NULL pointer to memmove - undefined behaviour
Check if 'old_base' is NULL and if so skip calling memmove.
This commit is contained in:
@@ -1150,7 +1150,9 @@ isc_buffer_reserve(isc_buffer_t *restrict dbuf, const unsigned int size) {
|
||||
if (!dbuf->dynamic) {
|
||||
void *old_base = dbuf->base;
|
||||
dbuf->base = isc_mem_get(dbuf->mctx, len);
|
||||
memmove(dbuf->base, old_base, dbuf->used);
|
||||
if (old_base != NULL) {
|
||||
memmove(dbuf->base, old_base, dbuf->used);
|
||||
}
|
||||
dbuf->dynamic = true;
|
||||
} else {
|
||||
dbuf->base = isc_mem_reget(dbuf->mctx, dbuf->base, dbuf->length,
|
||||
|
Reference in New Issue
Block a user