From: tb Date: Fri, 27 Sep 2024 13:10:39 +0000 (+0000) Subject: rsync: avoid reallocarray() with a nmemb of 0. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=54ac47722f20707625db02ce26ac8072e716fb52;p=openbsd rsync: avoid reallocarray() with a nmemb of 0. bset->blksz can be 0 here and how reallocarray() behaves is implementation defined. --- 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. */