mirror of
https://github.com/moparisthebest/curl
synced 2024-11-15 22:15:13 -05:00
The info types cannot be checked for explicity by ANDing the types since they
have not been properly defined to allow this! Instead of changing the defines and break the ABI/API, I opted to modify the code to check for exact type matches. CID 10 coverity.com scan
This commit is contained in:
parent
b9e5fecf5f
commit
e535a71c71
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
*
|
*
|
||||||
* This software is licensed as described in the file COPYING, which
|
* This software is licensed as described in the file COPYING, which
|
||||||
* you should have received as part of this distribution. The terms
|
* you should have received as part of this distribution. The terms
|
||||||
@ -78,36 +78,36 @@ CURLcode Curl_getinfo(struct SessionHandle *data, CURLINFO info, ...)
|
|||||||
#ifdef MSG_PEEK
|
#ifdef MSG_PEEK
|
||||||
char buf;
|
char buf;
|
||||||
#endif
|
#endif
|
||||||
|
CURLINFO type;
|
||||||
|
|
||||||
if(!data)
|
if(!data)
|
||||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||||
|
|
||||||
va_start(arg, info);
|
va_start(arg, info);
|
||||||
|
|
||||||
switch(info&CURLINFO_TYPEMASK) {
|
type = info&CURLINFO_TYPEMASK;
|
||||||
default:
|
if(type == CURLINFO_STRING) {
|
||||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
|
||||||
case CURLINFO_STRING:
|
|
||||||
param_charp = va_arg(arg, char **);
|
param_charp = va_arg(arg, char **);
|
||||||
if(NULL == param_charp)
|
if(NULL == param_charp)
|
||||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||||
break;
|
}
|
||||||
case CURLINFO_LONG:
|
else if(type == CURLINFO_LONG) {
|
||||||
param_longp = va_arg(arg, long *);
|
param_longp = va_arg(arg, long *);
|
||||||
if(NULL == param_longp)
|
if(NULL == param_longp)
|
||||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||||
break;
|
}
|
||||||
case CURLINFO_DOUBLE:
|
else if(type == CURLINFO_DOUBLE) {
|
||||||
param_doublep = va_arg(arg, double *);
|
param_doublep = va_arg(arg, double *);
|
||||||
if(NULL == param_doublep)
|
if(NULL == param_doublep)
|
||||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||||
break;
|
}
|
||||||
case CURLINFO_SLIST:
|
else if(type == CURLINFO_SLIST) {
|
||||||
param_slistp = va_arg(arg, struct curl_slist **);
|
param_slistp = va_arg(arg, struct curl_slist **);
|
||||||
if(NULL == param_slistp)
|
if(NULL == param_slistp)
|
||||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||||
|
|
||||||
switch(info) {
|
switch(info) {
|
||||||
case CURLINFO_EFFECTIVE_URL:
|
case CURLINFO_EFFECTIVE_URL:
|
||||||
|
Loading…
Reference in New Issue
Block a user