]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
buffer_tree: Assert that we don't pass NULL to memcpy().
authorAndre Noll <maan@tuebingen.mpg.de>
Tue, 20 May 2025 20:47:46 +0000 (22:47 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Thu, 22 May 2025 14:44:39 +0000 (16:44 +0200)
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

index 049eed364fad5e7315523b23f53d1d70b56d6461..9733ea5054ac1664c0939b601b92493c96a3fe67 100644 (file)
@@ -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);
 }