Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 May 2010 02:43:48 GMT
From:      Garrett Cooper <gcooper@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 178020 for review
Message-ID:  <201005100243.o4A2hmYb008685@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@178020?ac=10

Change 178020 by gcooper@gcooper-bayonetta on 2010/05/10 02:43:39

	Add sanity checks for -s and -S to avoid ENAMETOOLONG errors later on.

Affected files ...

.. //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/usr.sbin/pkg_install/create/main.c#7 edit

Differences ...

==== //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/usr.sbin/pkg_install/create/main.c#7 (text+ko) ====

@@ -14,8 +14,10 @@
 
 #include <sys/param.h>
 #include <err.h>
+#include <errno.h>
 #include <getopt.h>
 #include <libgen.h>
+#include <limits.h>
 #include <stdlib.h>
 
 #include <pkg.h>
@@ -122,10 +124,16 @@
 	    break;
 
 	case 's':
+	    if (strlen(SrcDir) > PATH_MAX)
+		errx(EXIT_FAILURE, "-s argument invalid: %s",
+		    strerror(ENAMETOOLONG));
 	    SrcDir = optarg;
 	    break;
 
 	case 'S':
+	    if (strlen(BaseDir) > PATH_MAX)
+		errx(EXIT_FAILURE, "-s argument invalid: %s",
+		    strerror(ENAMETOOLONG));
 	    BaseDir = optarg;
 	    break;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201005100243.o4A2hmYb008685>