From 9fd4e8c75d281ea6783344c5ee13e39777b59bd7 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 4 Jun 2020 08:23:40 +0200 Subject: Bug fix: use inclusive check to test parsed long int fits in int MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util.c b/util.c index 8e9a971..b2d8341 100644 --- a/util.c +++ b/util.c @@ -92,7 +92,7 @@ xfopen(const char *file, const char *mode) tmp = strtol(num, (void *)&num, 10); if (!errno && tmp >= 0 && #if INT_MAX < LONG_MAX - tmp < INT_MAX && + tmp <= INT_MAX && #endif !*num) { ret = fdopen((int)tmp, mode); -- cgit v1.2.3-70-g09d2