summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2024-08-03 22:00:32 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2024-08-03 22:00:32 +0000
commitcf142bcbada6c076b7b33ccc5d3cca55ff781719 (patch)
treee51e99e2d013cc94b53ee895e50a04aef0772dde
parent237c0548fd402837033a6828c1e7b68d77ede4ec (diff)
The maximum count is SKEY_MAX_SEQ + 1 not SKEY_MAX_SEQ - 1.
Sequence numbers are in the range [0, SKEY_MAX_SEQ] inclusive. This means the maximum value for the -n option (count) should be SKEY_MAX_SEQ + 1. From Denis Bodor.
-rw-r--r--usr.bin/skey/skey.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/skey/skey.c b/usr.bin/skey/skey.c
index 4197b697828..642e1cac7d3 100644
--- a/usr.bin/skey/skey.c
+++ b/usr.bin/skey/skey.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: skey.c,v 1.35 2019/01/25 00:19:26 millert Exp $ */
+/* $OpenBSD: skey.c,v 1.36 2024/08/03 22:00:31 millert Exp $ */
/*
* OpenBSD S/Key (skey.c)
*
@@ -60,7 +60,8 @@ main(int argc, char *argv[])
case 'n':
if (++i == argc)
usage();
- cnt = strtonum(argv[i], 1, SKEY_MAX_SEQ -1, &errstr);
+ cnt = strtonum(argv[i], 1, SKEY_MAX_SEQ + 1,
+ &errstr);
if (errstr)
usage();
break;