diff options
author | deraadt@openbsd.org <deraadt@openbsd.org> | 2017-05-31 11:15:42 +0200 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2017-06-01 06:55:22 +0200 |
commit | 9e509d4ec97cb3d71696f1a2f1fdad254cbbce11 (patch) | |
tree | 8f33ae8fa9bcfa0d9c80d0e0f1555a814a844bc1 /bitmap.c | |
parent | upstream commit (diff) | |
download | openssh-9e509d4ec97cb3d71696f1a2f1fdad254cbbce11.tar.xz openssh-9e509d4ec97cb3d71696f1a2f1fdad254cbbce11.zip |
upstream commit
Switch to recallocarray() for a few operations. Both
growth and shrinkage are handled safely, and there also is no need for
preallocation dances. Future changes in this area will be less error prone.
Review and one bug found by markus
Upstream-ID: 822d664d6a5a1d10eccb23acdd53578a679d5065
Diffstat (limited to 'bitmap.c')
-rw-r--r-- | bitmap.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -87,7 +87,7 @@ reserve(struct bitmap *b, u_int n) return -1; /* invalid */ nlen = (n / BITMAP_BITS) + 1; if (b->len < nlen) { - if ((tmp = reallocarray(b->d, nlen, BITMAP_BYTES)) == NULL) + if ((tmp = recallocarray(b->d, b->len, nlen, BITMAP_BYTES)) == NULL) return -1; b->d = tmp; memset(b->d + b->len, 0, (nlen - b->len) * BITMAP_BYTES); |