diff options
author | Jason Dixon <jdixon@cvs.openbsd.org> | 2007-05-01 01:26:31 +0000 |
---|---|---|
committer | Jason Dixon <jdixon@cvs.openbsd.org> | 2007-05-01 01:26:31 +0000 |
commit | 590163d65312d46ce50fbc60b432282034b60d53 (patch) | |
tree | 2fbc429ee3707485fcb25104b991b5bb31d39ec2 /usr.bin/encrypt/encrypt.c | |
parent | 99beccf5f8090559ad8dfc7fbbd1161bdadf4c1a (diff) |
use strtonum; ok millert@
Diffstat (limited to 'usr.bin/encrypt/encrypt.c')
-rw-r--r-- | usr.bin/encrypt/encrypt.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.bin/encrypt/encrypt.c b/usr.bin/encrypt/encrypt.c index 0468f2d4034..e243d34441d 100644 --- a/usr.bin/encrypt/encrypt.c +++ b/usr.bin/encrypt/encrypt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: encrypt.c,v 1.26 2007/03/20 03:50:39 tedu Exp $ */ +/* $OpenBSD: encrypt.c,v 1.27 2007/05/01 01:26:25 jdixon Exp $ */ /* * Copyright (c) 1996, Jason Downs. All rights reserved. @@ -35,6 +35,7 @@ #include <string.h> #include <unistd.h> #include <login_cap.h> +#include <limits.h> /* * Very simple little program, for encrypting passwords from the command @@ -144,6 +145,7 @@ main(int argc, char **argv) int prompt = 0; int rounds; void *extra = NULL; /* Store salt or number of rounds */ + const char *errstr; if (strcmp(__progname, "makekey") == 0) operation = DO_MAKEKEY; @@ -179,7 +181,9 @@ main(int argc, char **argv) if (operation != -1) usage(); operation = DO_BLF; - rounds = atoi(optarg); + rounds = strtonum(optarg, 1, INT_MAX, &errstr); + if (errstr != NULL) + errx(1, "%s: %s", errstr, optarg); extra = &rounds; break; |