PERFORCE change 178020 for review
Garrett Cooper
gcooper at FreeBSD.org
Mon May 10 02:43:49 UTC 2010
http://p4web.freebsd.org/@@178020?ac=10
Change 178020 by gcooper at 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;
More information about the p4-projects
mailing list