]> git.ipfire.org Git - thirdparty/xz.git/commitdiff
liblzma: Add dest and src NULL checks to lzma_index_cat.
authorJia Tan <jiat0218@gmail.com>
Wed, 21 Sep 2022 08:15:50 +0000 (16:15 +0800)
committerLasse Collin <lasse.collin@tukaani.org>
Thu, 29 Sep 2022 13:54:39 +0000 (16:54 +0300)
The documentation states LZMA_PROG_ERROR can be returned from
lzma_index_cat. Previously, lzma_index_cat could not return
LZMA_PROG_ERROR. Now, the validation is similar to
lzma_index_append, which does a NULL check on the index
parameter.

src/liblzma/common/index.c

index e0b14a3d5d30c4cb9060378fef729d803cfd078c..24ec3c10c2e907c36ba313937cbf12011da5f88c 100644 (file)
@@ -771,6 +771,9 @@ extern LZMA_API(lzma_ret)
 lzma_index_cat(lzma_index *restrict dest, lzma_index *restrict src,
                const lzma_allocator *allocator)
 {
+       if (dest == NULL || src == NULL)
+               return LZMA_PROG_ERROR;
+
        const lzma_vli dest_file_size = lzma_index_file_size(dest);
 
        // Check that we don't exceed the file size limits.