From: Andre Noll Date: Tue, 20 May 2025 20:47:46 +0000 (+0200) Subject: buffer_tree: Assert that we don't pass NULL to memcpy(). X-Git-Url: https://git.tuebingen.mpg.de/?a=commitdiff_plain;h=24c1b93962fc54d716d15ec914f6ca35b4b50b8b;p=paraslash.git buffer_tree: Assert that we don't pass NULL to memcpy(). The buffer pointer cannot be NULL here because this only happens when the buffer tree area is full, which is not the case thanks to the previous n <= btr_pool_unused(btrp) check. --- diff --git a/buffer_tree.c b/buffer_tree.c index 049eed36..9733ea50 100644 --- a/buffer_tree.c +++ b/buffer_tree.c @@ -507,6 +507,7 @@ void btr_copy(const void *src, size_t n, struct btr_pool *btrp, return; sz = btr_pool_get_buffer(btrp, &buf); assert(sz >= n - copy); + assert(buf); memcpy(buf, src + copy, n - copy); btr_add_output_pool(btrp, n - copy, btrn); }