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:
Daniel Stenberg 2026-03-17 13:23:30 +01:00
parent 38107d3354
commit e894699c1e
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -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