summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2012-11-14 02:32:16 +0000
committerDamien Miller <djm@cvs.openbsd.org>2012-11-14 02:32:16 +0000
commit4982a4fad195f90c9844268f6d97dee3ec11aef2 (patch)
tree8f1d69716dc5ff6ee23ffb6c0b21d11caced7f45
parent243099fabe53eb041e03b29103ba577283a7f35e (diff)
allow the full range of unsigned serial numbers; 'fine' deraadt@
-rw-r--r--usr.bin/ssh/ssh-keygen.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/usr.bin/ssh/ssh-keygen.c b/usr.bin/ssh/ssh-keygen.c
index da0f594b646..4ecbf388723 100644
--- a/usr.bin/ssh/ssh-keygen.c
+++ b/usr.bin/ssh/ssh-keygen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-keygen.c,v 1.218 2012/10/02 07:07:45 djm Exp $ */
+/* $OpenBSD: ssh-keygen.c,v 1.219 2012/11/14 02:32:15 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1922,7 +1922,7 @@ main(int argc, char **argv)
{
char dotsshdir[MAXPATHLEN], comment[1024], *passphrase1, *passphrase2;
char *checkpoint = NULL;
- char out_file[MAXPATHLEN], *rr_hostname = NULL;
+ char out_file[MAXPATHLEN], *rr_hostname = NULL, *ep;
Key *private, *public;
struct passwd *pw;
struct stat st;
@@ -2126,9 +2126,11 @@ main(int argc, char **argv)
parse_cert_times(optarg);
break;
case 'z':
- cert_serial = strtonum(optarg, 0, LLONG_MAX, &errstr);
- if (errstr)
- fatal("Invalid serial number: %s", errstr);
+ errno = 0;
+ cert_serial = strtoull(optarg, &ep, 10);
+ if (*optarg < '0' || *optarg > '9' || *ep != '\0' ||
+ (errno == ERANGE && cert_serial == ULLONG_MAX))
+ fatal("Invalid serial number \"%s\"", optarg);
break;
case '?':
default: