From: Vincent Lefevre Date: Tue, 19 Jun 2018 07:37:56 +0000 (+0200) Subject: Reset errno to 0 before calling strtol and testing it in mutt_atol. X-Git-Tag: mutt-1-11-rel~135 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1e3473ec5c06e96d86e843d66c1e926f4aac776e;p=mutt Reset errno to 0 before calling strtol and testing it in mutt_atol. Otherwise providing LONG_MAX+1 then LONG_MAX gave an error for LONG_MAX too. --- diff --git a/lib.c b/lib.c index 583d2fff..f008aae0 100644 --- a/lib.c +++ b/lib.c @@ -1077,6 +1077,7 @@ int mutt_atol (const char *str, long *dst) return 0; } + errno = 0; *res = strtol (str, &e, 10); if ((*res == LONG_MAX && errno == ERANGE) || (e && *e != '\0'))