diff options
author | matteo <matteo@FreeBSD.org> | 2006-05-12 15:14:43 +0000 |
---|---|---|
committer | matteo <matteo@FreeBSD.org> | 2006-05-12 15:14:43 +0000 |
commit | 08978d5bee9bfc81ae25a6b3a8971577532cc9aa (patch) | |
tree | ac87efd4d26711159612b31c16178a356fdc8f3c /usr.sbin | |
parent | b5d9042424087b77c7c9250b5bceb21a1deb4d83 (diff) | |
download | FreeBSD-src-08978d5bee9bfc81ae25a6b3a8971577532cc9aa.zip FreeBSD-src-08978d5bee9bfc81ae25a6b3a8971577532cc9aa.tar.gz |
correct strtol(3) usage and style(9)
Reviewed by: maxim
MFC after: 2 weeks
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/jail/jail.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/usr.sbin/jail/jail.c b/usr.sbin/jail/jail.c index 4580bac..e21fcc8 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; |