diff options
author | pfg <pfg@FreeBSD.org> | 2017-05-09 23:31:09 +0000 |
---|---|---|
committer | pfg <pfg@FreeBSD.org> | 2017-05-09 23:31:09 +0000 |
commit | 9498b1d27a47f26ccd6e4233ad479503fc73c207 (patch) | |
tree | 74b09547df77f0a50b0162e21daab37fb0bc1ed5 /lib/libutil/pw_util.c | |
parent | 643d95272bd8bc6a4fd1c99b1e560e28ea4f57c7 (diff) | |
download | FreeBSD-src-9498b1d27a47f26ccd6e4233ad479503fc73c207.zip FreeBSD-src-9498b1d27a47f26ccd6e4233ad479503fc73c207.tar.gz |
MFC r317265:
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.
Diffstat (limited to 'lib/libutil/pw_util.c')
-rw-r--r-- | lib/libutil/pw_util.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libutil/pw_util.c b/lib/libutil/pw_util.c index 0c34e67..627d79b 100644 --- a/lib/libutil/pw_util.c +++ b/lib/libutil/pw_util.c @@ -468,7 +468,7 @@ pw_copy(int ffd, int tfd, const struct passwd *pw, struct passwd *old_pw) if (eof) break; while ((size_t)(q - p) >= size) { - if ((tmp = realloc(buf, size * 2)) == NULL) { + if ((tmp = reallocarray(buf, 2, size)) == NULL) { warnx("passwd line too long"); goto err; } |