summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatteo Riondato <matteo@FreeBSD.org>2006-05-12 15:14:43 +0000
committerMatteo Riondato <matteo@FreeBSD.org>2006-05-12 15:14:43 +0000
commitb484e04bf9e39dfee879785d3be04753ce5f3635 (patch)
treeac87efd4d26711159612b31c16178a356fdc8f3c
parentab7350b7decdcb77581449d7b7aed46eb6ef349d (diff)
Notes
-rw-r--r--usr.sbin/jail/jail.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/usr.sbin/jail/jail.c b/usr.sbin/jail/jail.c
index 4580bac7f9e1..e21fcc847d49 100644
--- a/usr.sbin/jail/jail.c
+++ b/usr.sbin/jail/jail.c
@@ -55,14 +55,15 @@ main(int argc, char **argv)
struct passwd *pwd = NULL;
struct in_addr in;
gid_t groups[NGROUPS];
- int ch, i, iflag, Jflag, lflag, ngroups, uflag, Uflag;
- char path[PATH_MAX], *username, *JidFile;
+ int ch, i, iflag, Jflag, lflag, ngroups, securelevel, uflag, Uflag;
+ char path[PATH_MAX], *ep, *username, *JidFile;
static char *cleanenv;
const char *shell, *p = NULL;
- int securelevel = -1;
+ long ltmp;
FILE *fp;
iflag = Jflag = lflag = uflag = Uflag = 0;
+ securelevel = -1;
username = JidFile = cleanenv = NULL;
fp = NULL;
@@ -76,7 +77,10 @@ main(int argc, char **argv)
Jflag = 1;
break;
case 's':
- securelevel = (int) strtol(optarg, NULL, 0);
+ ltmp = strtol(optarg, &ep, 0);
+ if (*ep || ep == optarg || ltmp > INT_MAX || !ltmp)
+ errx(1, "invalid securelevel: `%s'", optarg);
+ securelevel = ltmp;
break;
case 'u':
username = optarg;