Fixes: d7b36a45fc3f ("[indxbib]: Mitigate Savannah #65452.")
Link: <https://savannah.gnu.org/bugs/?65452>
Cc: "G. Branden Robinson" <bran...@debian.org>
Cc: Dave Kemper <saint.s...@gmail.com>
Cc: "James K. Lowden" <jklow...@schemamania.org>
Cc: Colin Watson <cjwat...@debian.org>
Cc: Werner LEMBERG <w...@gnu.org>
Signed-off-by: Alejandro Colomar <a...@kernel.org>
---
 src/utils/indxbib/indxbib.cpp | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/src/utils/indxbib/indxbib.cpp b/src/utils/indxbib/indxbib.cpp
index 68d5756e2..adb951085 100644
--- a/src/utils/indxbib/indxbib.cpp
+++ b/src/utils/indxbib/indxbib.cpp
@@ -340,13 +340,9 @@ static void check_integer_arg(char opt, const char *arg, 
int min, int *res)
   char *ptr;
   errno = 0;
   long n = strtol(arg, &ptr, 10);
-  if (ERANGE == errno)
-    fatal("argument to -%1 must be between %2 and %3", arg, min, INT_MAX);
   if (ptr == arg)
     fatal("argument to -%1 not an integer", opt);
-  if (n < min)
-    fatal("argument to -%1 must not be less than %2", opt, min);
-  if (n > INT_MAX)
+  if (ERANGE == errno || n < min || n > INT_MAX)
     fatal("argument to -%1 must be between %2 and %3", arg, min, INT_MAX);
   if (*ptr != '\0')
     fatal("junk after integer argument to -%1", opt);
-- 
2.43.0

Attachment: signature.asc
Description: PGP signature

Reply via email to