]> git.cameronkatri.com Git - pw-darwin.git/blobdiff - libutil/gr_util.c
Make pw(8) showuser work the same with or without -R <path> for non-root
[pw-darwin.git] / libutil / gr_util.c
index 99f268cf1833a6fc2a79fdb33232cbbdcb62d5c9..796cbf021ded95b1ccfb3e21b7dac366ae2bde23 100644 (file)
@@ -1,4 +1,6 @@
 /*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
  * Copyright (c) 2008 Sean C. Farley <scf@FreeBSD.org>
  * All rights reserved.
  *
@@ -205,7 +207,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;
                                }