Skip to content

Commit 1da5be2

Browse files
authored
Merge pull request #151 from irisjae/master
Set errno to 0 before strtol
2 parents 032617b + c88e815 commit 1da5be2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

http.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,9 @@ set_curlopt(CURL* handle, const http_curlopt *opt)
786786
/* Argument is a long */
787787
else if (opt->curlopt_type == CURLOPT_LONG)
788788
{
789-
long value_long = strtol(opt->curlopt_val, NULL, 10);
789+
long value_long;
790+
errno = 0;
791+
value_long = strtol(opt->curlopt_val, NULL, 10);
790792
if ( errno == EINVAL || errno == ERANGE )
791793
elog(ERROR, "invalid integer provided for '%s'", opt->curlopt_str);
792794

0 commit comments

Comments
 (0)