From 54ac47722f20707625db02ce26ac8072e716fb52 Mon Sep 17 00:00:00 2001 From: tb Date: Fri, 27 Sep 2024 13:10:39 +0000 Subject: [PATCH] rsync: avoid reallocarray() with a nmemb of 0. bset->blksz can be 0 here and how reallocarray() behaves is implementation defined. --- usr.bin/rsync/blocks.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.bin/rsync/blocks.c b/usr.bin/rsync/blocks.c index 7b774e68df4..97a51a21e36 100644 --- a/usr.bin/rsync/blocks.c +++ b/usr.bin/rsync/blocks.c @@ -1,4 +1,4 @@ -/* $OpenBSD: blocks.c,v 1.25 2024/09/27 13:06:21 tb Exp $ */ +/* $OpenBSD: blocks.c,v 1.26 2024/09/27 13:10:39 tb Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons * @@ -91,7 +91,7 @@ blkhash_set(struct blktab *p, const struct blkset *bset) struct blkhash *blks; size_t i, idx; - if (bset == NULL) + if (bset == NULL || bset->blksz == 0) return 1; /* Wipe clean the table. */ -- 2.20.1