summaryrefslogtreecommitdiffstats
path: root/libutil/gr_util.c
diff options
context:
space:
mode:
authorPedro F. Giffuni <pfg@FreeBSD.org>2017-04-21 19:27:33 +0000
committerPedro F. Giffuni <pfg@FreeBSD.org>2017-04-21 19:27:33 +0000
commit1234cbbb41b6bf57c7094a5e9d015db7b303c44c (patch)
tree5d0f4dbfb4599374995f8bdcdefacb43043ee1f7 /libutil/gr_util.c
parent841aacdd6b25fd8a7324623dbc2ebae7e572a6f6 (diff)
downloadpw-darwin-1234cbbb41b6bf57c7094a5e9d015db7b303c44c.tar.gz
pw-darwin-1234cbbb41b6bf57c7094a5e9d015db7b303c44c.zip
lib: initial use of reallocarray(3).
Make some use of reallocarray, attempting to limit it to cases where the parameters are unsigned and there is some theoretical chance of overflow. MFC afer: 2 weeks Differential Revision: https://reviews.freebsd.org/D9980
Diffstat (limited to 'libutil/gr_util.c')
-rw-r--r--libutil/gr_util.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libutil/gr_util.c b/libutil/gr_util.c
index 99f268c..fcc0820 100644
--- a/libutil/gr_util.c
+++ b/libutil/gr_util.c
@@ -205,7 +205,7 @@ gr_copy(int ffd, int tfd, const struct group *gr, struct group *old_gr)
if (eof)
break;
while ((size_t)(q - p) >= size) {
- if ((tmp = realloc(buf, size * 2)) == NULL) {
+ if ((tmp = reallocarray(buf, 2, size)) == NULL) {
warnx("group line too long");
goto err;
}