curl/0002-curl-7.55.0-32bit-overflow.patch

27 lines
814 B
Diff

From b478816720e1a6b909f454c421dc620e18383947 Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Wed, 9 Aug 2017 14:27:05 +0200
Subject: [PATCH] curl: avoid int overflow on arches with 32bit long
This makes test1427 pass on i386.
---
src/tool_paramhlp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/tool_paramhlp.c b/src/tool_paramhlp.c
index b9dedc9..205c260 100644
--- a/src/tool_paramhlp.c
+++ b/src/tool_paramhlp.c
@@ -218,7 +218,7 @@ static ParameterError str2double(double *val, const char *str, long max)
num = strtod(str, &endptr);
if(errno == ERANGE)
return PARAM_NUMBER_TOO_LARGE;
- if((long)num > max) {
+ if(num > (double)LONG_MAX || (long)num > max) {
/* too large */
return PARAM_NUMBER_TOO_LARGE;
}
--
2.9.4