gbranden pushed a commit to branch master
in repository groff.
commit 573dcdc12ee01dc476c1c06a8b6fe5c8f9958ad3
Author: Alejandro Colomar <[email protected]>
AuthorDate: Sat Mar 16 13:35:02 2024 +0100
[indxbib]: Clear `errno` before `strotol()` call.
* src/utils/indxbib/indxbib.cpp (check_integer_arg): Clear `errno`
before calling `strtol()`. Otherwise, `errno` may hold `ERANGE` from
before. See strtol(3).
Fixes: d7b36a45fc3f ("[indxbib]: Mitigate Savannah #65452.")
Link: <https://savannah.gnu.org/bugs/?65452>
Cc: "G. Branden Robinson" <[email protected]>
Cc: Dave Kemper <[email protected]>
Cc: "James K. Lowden" <[email protected]>
Cc: Colin Watson <[email protected]>
Cc: Werner LEMBERG <[email protected]>
Cc: James Clark <[email protected]>
Signed-off-by: Alejandro Colomar <[email protected]>
---
ChangeLog | 6 ++++++
src/utils/indxbib/indxbib.cpp | 1 +
2 files changed, 7 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 9336aa317..5af96da39 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-03-16 Alejandro Colomar <[email protected]>
+
+ * src/utils/indxbib/indxbib.cpp (check_integer_arg): Clear
+ `errno` before calling `strtol()`. Otherwise, `errno` may hold
+ `ERANGE` from before. See strtol(3).
+
2024-03-16 Alejandro Colomar <[email protected]>
* src/utils/indxbib/indxbib.cpp (check_integer_arg): Don't
diff --git a/src/utils/indxbib/indxbib.cpp b/src/utils/indxbib/indxbib.cpp
index c5996c279..6253e4782 100644
--- a/src/utils/indxbib/indxbib.cpp
+++ b/src/utils/indxbib/indxbib.cpp
@@ -338,6 +338,7 @@ static void usage(FILE *stream)
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);
_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit