]> git.cameronkatri.com Git - pw-darwin.git/blobdiff - libutil/gr_util.c
lib: initial use of reallocarray(3).
[pw-darwin.git] / libutil / gr_util.c
index 99f268cf1833a6fc2a79fdb33232cbbdcb62d5c9..fcc08209e0cc4df85ed5f2d9096ec266b086785a 100644 (file)
@@ -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 (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;
                                }
                                        warnx("group line too long");
                                        goto err;
                                }