From 41a50e0c570a7b0937fa127d1dec12876715958f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Sat, 9 Jan 2016 18:41:46 +0000 Subject: [PATCH] Set an upper limit to the number of codes generated by the calc command. git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@882 185d5e19-27fe-0310-9dcf-9bff6b9f3609 --- bin/oathkey/oathkey.1 | 5 +++-- bin/oathkey/oathkey.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/oathkey/oathkey.1 b/bin/oathkey/oathkey.1 index 981b3f3..5b43280 100644 --- a/bin/oathkey/oathkey.1 +++ b/bin/oathkey/oathkey.1 @@ -28,7 +28,7 @@ .\" .\" $Id$ .\" -.Dd October 23, 2015 +.Dd January 9, 2016 .Dt OATHKEY 1 .Os .Sh NAME @@ -78,7 +78,8 @@ The commands are: Compute and display the current code for the given key. If a count is specified, compute and display .Ar count -codes in total, starting with the current code. +codes in total, starting with the current code, up to a maximum of +1,000 codes. If writeback mode is enabled, the user's keyfile is updated to prevent reuse. .It Cm genkey Ar hotp | totp diff --git a/bin/oathkey/oathkey.c b/bin/oathkey/oathkey.c index bbaa0da..40807b3 100644 --- a/bin/oathkey/oathkey.c +++ b/bin/oathkey/oathkey.c @@ -297,7 +297,7 @@ oathkey_calc(int argc, char *argv[]) return (RET_USAGE); if (argc > 0) { n = strtoul(argv[0], &end, 10); - if (end == argv[0] || *end != '\0' || n < 1) + if (end == argv[0] || *end != '\0' || n < 1 || n > 1000) return (RET_USAGE); } else { n = 1;