curl_easy_getinfo: error code on NULL arg

When passing an address to curl_easy_getinfo to retrieve a value and the
address is NULL, return CURLE_BAD_FUNCTION_ARGUMENT instead of
CURLE_UNKNOWN_OPTION.

Closes #18512
This commit is contained in:
Stefan Eissing 2025-09-10 11:55:24 +02:00 committed by Daniel Stenberg
parent 80ac5fb2ec
commit a782867c9f
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2

View file

@ -621,7 +621,7 @@ CURLcode Curl_getinfo(struct Curl_easy *data, CURLINFO info, ...)
struct curl_slist **param_slistp = NULL;
curl_socket_t *param_socketp = NULL;
int type;
CURLcode result = CURLE_UNKNOWN_OPTION;
CURLcode result = CURLE_BAD_FUNCTION_ARGUMENT;
if(!data)
return CURLE_BAD_FUNCTION_ARGUMENT;
@ -661,6 +661,7 @@ CURLcode Curl_getinfo(struct Curl_easy *data, CURLINFO info, ...)
result = getinfo_socket(data, info, param_socketp);
break;
default:
result = CURLE_UNKNOWN_OPTION;
break;
}