On Sat, 15 Nov 2014 19:27:11 -0700 (MST)
Theo de Raadt <[email protected]> wrote:

> Nope.  That is unsuitable use of issetugid.  This is not a setuid
> program.

Revised diff below omits that change then.



Index: sbin/newfs/newfs.c
===================================================================
RCS file: /cvs/src/sbin/newfs/newfs.c,v
retrieving revision 1.97
diff -u -p -r1.97 newfs.c
--- sbin/newfs/newfs.c  20 Jul 2014 01:38:40 -0000      1.97
+++ sbin/newfs/newfs.c  16 Nov 2014 03:50:57 -0000
@@ -748,8 +748,11 @@ copy(char *src, char *dst, struct mfs_ar
        char *const argv[] = { "pax", "-rw", "-pe", ".", dst, NULL } ;
 
        dir = isdir(src);
-       if (dir)
-               strlcpy(mountpoint, src, sizeof(mountpoint));
+       if (dir) {
+               size_t n = strlcpy(mountpoint, src, sizeof(mountpoint));
+               if(n >= sizeof(mountpoint))
+                       errx(1, "%s: path too long", src);
+       }
        else {
                created = gettmpmnt(mountpoint, sizeof(mountpoint));
                memset(&mount_args, 0, sizeof(mount_args));

Reply via email to