summaryrefslogtreecommitdiff
path: root/ssh-keygen.c
diff options
context:
space:
mode:
authordjm <djm>2012-11-14 08:04:33 +0000
committerdjm <djm>2012-11-14 08:04:33 +0000
commite6b13b8a1b2f87db874cd8079829921b257bdd1f (patch)
treec9a59057aea7c848e12ca0183ae07e5c0414b41a /ssh-keygen.c
parent6c805583837488190b307bf366fc62735c41bc55 (diff)
downloadopenssh-e6b13b8a1b2f87db874cd8079829921b257bdd1f.tar.gz
- djm@cvs.openbsd.org 2012/11/14 02:32:15
[ssh-keygen.c] allow the full range of unsigned serial numbers; 'fine' deraadt@
Diffstat (limited to 'ssh-keygen.c')
-rw-r--r--ssh-keygen.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/ssh-keygen.c b/ssh-keygen.c
index 11d1dd02..2d8af679 100644
--- a/ssh-keygen.c
+++ b/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
@@ -1937,7 +1937,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;
@@ -2145,9 +2145,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: