summaryrefslogtreecommitdiff
path: root/ssh-keygen.c
diff options
context:
space:
mode:
authordtucker@openbsd.org <dtucker@openbsd.org>2019-08-08 08:02:57 +0000
committerDarren Tucker <dtucker@dtucker.net>2019-08-08 20:01:39 +1000
commit7afc45c3ed72672690014dc432edc223b23ae288 (patch)
tree7a67f467c295010e16ebe7c073de30d652d64e4d /ssh-keygen.c
parentc31e4f5fb3915c040061981a67224de7650ab34b (diff)
upstream: Allow the maximimum uint32 value for the argument passed to
-b which allows better error messages from later validation. bz#3050, ok djm@ OpenBSD-Commit-ID: 10adf6876b2401b3dc02da580ebf67af05861673
Diffstat (limited to 'ssh-keygen.c')
-rw-r--r--ssh-keygen.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/ssh-keygen.c b/ssh-keygen.c
index 11e391878..d71548803 100644
--- a/ssh-keygen.c
+++ b/ssh-keygen.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh-keygen.c,v 1.339 2019/08/05 21:45:27 naddy Exp $ */ 1/* $OpenBSD: ssh-keygen.c,v 1.340 2019/08/08 08:02:57 dtucker Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -987,7 +987,7 @@ do_gen_all_hostkeys(struct passwd *pw)
987 { NULL, NULL, NULL } 987 { NULL, NULL, NULL }
988 }; 988 };
989 989
990 u_int bits = 0; 990 u_int32_t bits = 0;
991 int first = 0; 991 int first = 0;
992 struct stat st; 992 struct stat st;
993 struct sshkey *private, *public; 993 struct sshkey *private, *public;
@@ -2450,7 +2450,7 @@ main(int argc, char **argv)
2450 int print_public = 0, print_generic = 0, cert_serial_autoinc = 0; 2450 int print_public = 0, print_generic = 0, cert_serial_autoinc = 0;
2451 unsigned long long cert_serial = 0; 2451 unsigned long long cert_serial = 0;
2452 char *identity_comment = NULL, *ca_key_path = NULL; 2452 char *identity_comment = NULL, *ca_key_path = NULL;
2453 u_int bits = 0; 2453 u_int32_t bits = 0;
2454 FILE *f; 2454 FILE *f;
2455 const char *errstr; 2455 const char *errstr;
2456 int log_level = SYSLOG_LEVEL_INFO; 2456 int log_level = SYSLOG_LEVEL_INFO;
@@ -2493,7 +2493,8 @@ main(int argc, char **argv)
2493 gen_all_hostkeys = 1; 2493 gen_all_hostkeys = 1;
2494 break; 2494 break;
2495 case 'b': 2495 case 'b':
2496 bits = (u_int32_t)strtonum(optarg, 10, 32768, &errstr); 2496 bits = (u_int32_t)strtonum(optarg, 1, UINT32_MAX,
2497 &errstr);
2497 if (errstr) 2498 if (errstr)
2498 fatal("Bits has bad value %s (%s)", 2499 fatal("Bits has bad value %s (%s)",
2499 optarg, errstr); 2500 optarg, errstr);