]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
test_mkfds: avoid multiplication overflow
authorThomas Weißschuh <thomas@t-8ch.de>
Mon, 10 Oct 2022 16:00:07 +0000 (18:00 +0200)
committerThomas Weißschuh <thomas@t-8ch.de>
Mon, 10 Oct 2022 16:01:10 +0000 (18:01 +0200)
tests/helpers/test_mkfds.c

index f2d61b9d51f6a1001435670b241c9bd7e5b0154e..c43c3de2f286c60c534ad8d7b9df0676a779e15e 100644 (file)
@@ -694,7 +694,7 @@ static void *make_mmapped_packet_socket(const struct factory *factory, struct fd
                close(sd);
                errx(EXIT_FAILURE, "memory exhausted");
        }
-       munmap_data->len = req.tp_block_size * req.tp_block_nr;
+       munmap_data->len = (size_t) req.tp_block_size * req.tp_block_nr;
        munmap_data->ptr = mmap(NULL, munmap_data->len, PROT_WRITE, MAP_SHARED, sd, 0);
        if (munmap_data->ptr == MAP_FAILED) {
                int e = errno;