]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
strerror: skip errnum >= 0 assertion on windows
authorJay Satiro <raysatiro@yahoo.com>
Thu, 21 Jan 2021 07:46:07 +0000 (02:46 -0500)
committerJay Satiro <raysatiro@yahoo.com>
Fri, 22 Jan 2021 06:47:04 +0000 (01:47 -0500)
On Windows an error number may be greater than INT_MAX and negative once
cast to int.

The assertion is checked only in debug builds.

Closes https://github.com/curl/curl/pull/6504

lib/strerror.c

index 9b2fc26c2f2a0e1850ff3ec3e97cba2c1498e5e1..0216c71937953a724bc026c39aa09100a6d732c1 100644 (file)
@@ -721,7 +721,9 @@ const char *Curl_strerror(int err, char *buf, size_t buflen)
   if(!buflen)
     return NULL;
 
+#ifndef WIN32
   DEBUGASSERT(err >= 0);
+#endif
 
   max = buflen - 1;
   *buf = '\0';