summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2024-09-27 13:10:40 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2024-09-27 13:10:40 +0000
commitaae78e9e162d374e96b6e4c3f5e66bed33ea38ec (patch)
tree03fa0b7a208ca1b219886ec0351cc68347e401ba /usr.bin
parent28072499f8a27e624879072f4f835fb97861645e (diff)
rsync: avoid reallocarray() with a nmemb of 0.
bset->blksz can be 0 here and how reallocarray() behaves is implementation defined.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/rsync/blocks.c4
1 files 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 <kristaps@bsd.lv>
*
@@ -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. */