mirror of
https://github.com/curl/curl.git
synced 2026-04-11 12:01:42 +08:00
strerr: correct the strerror_s() return code condition
In curlx_strerror on Windows, the condition checks `!strerror_s(...)`
(true on success) and therefore always evaluates the fallback block.
Even when strerror_s successfully produced a valid errno message.
Follow-up to 1eca08a541
Pointed out by Codex Security
Closes #20955
This commit is contained in:
parent
38107d3354
commit
e894699c1e
@ -263,7 +263,7 @@ const char *curlx_strerror(int err, char *buf, size_t buflen)
|
||||
*buf = '\0';
|
||||
|
||||
#ifdef _WIN32
|
||||
if((!strerror_s(buf, buflen, err) || !strcmp(buf, "Unknown error")) &&
|
||||
if((strerror_s(buf, buflen, err) || !strcmp(buf, "Unknown error")) &&
|
||||
#ifdef USE_WINSOCK
|
||||
!get_winsock_error(err, buf, buflen) &&
|
||||
#endif
|
||||
|
||||
Loading…
Reference in New Issue
Block a user