From 24c1b93962fc54d716d15ec914f6ca35b4b50b8b Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Tue, 20 May 2025 22:47:46 +0200 Subject: [PATCH] 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. --- buffer_tree.c | 1 + 1 file changed, 1 insertion(+) 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); } -- 2.39.5