mirror of
https://github.com/curl/curl.git
synced 2026-08-25 19:33:32 +03:00
strtok: use namespaced strtok_r macro instead of redefining it
krb5 defines `strtok_r` for Windows unconditionally in its public
header:
dc5554394e/src/include/win-mac.h (L214-L215)
resulting in this warning:
```
lib\strtok.h(31,9): warning C4005: 'strtok_r': macro redefinition
C:\vcpkg\installed\x64-windows\include\win-mac.h(215,9):
see previous definition of 'strtok_r'
```
The krb5 macro collides with curl's internal definition, in case
the `strtok_r` function is undetected and falling back to a local
replacement.
Reported-by: Tal Regev
Bug: https://github.com/curl/curl/pull/15549#issuecomment-2468251761
Closes #15564
This commit is contained in:
parent
92124838c6
commit
22c45844af
6 changed files with 20 additions and 18 deletions
|
|
@ -227,12 +227,12 @@ static CURLcode auth_digest_get_qop_values(const char *options, int *value)
|
|||
*value = 0;
|
||||
|
||||
/* Tokenise the list of qop values. Use a temporary clone of the buffer since
|
||||
strtok_r() ruins it. */
|
||||
Curl_strtok_r() ruins it. */
|
||||
tmp = strdup(options);
|
||||
if(!tmp)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
|
||||
token = strtok_r(tmp, ",", &tok_buf);
|
||||
token = Curl_strtok_r(tmp, ",", &tok_buf);
|
||||
while(token) {
|
||||
if(strcasecompare(token, DIGEST_QOP_VALUE_STRING_AUTH))
|
||||
*value |= DIGEST_QOP_VALUE_AUTH;
|
||||
|
|
@ -241,7 +241,7 @@ static CURLcode auth_digest_get_qop_values(const char *options, int *value)
|
|||
else if(strcasecompare(token, DIGEST_QOP_VALUE_STRING_AUTH_CONF))
|
||||
*value |= DIGEST_QOP_VALUE_AUTH_CONF;
|
||||
|
||||
token = strtok_r(NULL, ",", &tok_buf);
|
||||
token = Curl_strtok_r(NULL, ",", &tok_buf);
|
||||
}
|
||||
|
||||
free(tmp);
|
||||
|
|
@ -553,12 +553,12 @@ CURLcode Curl_auth_decode_digest_http_message(const char *chlg,
|
|||
else if(strcasecompare(value, "qop")) {
|
||||
char *tok_buf = NULL;
|
||||
/* Tokenize the list and choose auth if possible, use a temporary
|
||||
clone of the buffer since strtok_r() ruins it */
|
||||
clone of the buffer since Curl_strtok_r() ruins it */
|
||||
tmp = strdup(content);
|
||||
if(!tmp)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
|
||||
token = strtok_r(tmp, ",", &tok_buf);
|
||||
token = Curl_strtok_r(tmp, ",", &tok_buf);
|
||||
while(token) {
|
||||
/* Pass additional spaces here */
|
||||
while(*token && ISBLANK(*token))
|
||||
|
|
@ -569,7 +569,7 @@ CURLcode Curl_auth_decode_digest_http_message(const char *chlg,
|
|||
else if(strcasecompare(token, DIGEST_QOP_VALUE_STRING_AUTH_INT)) {
|
||||
foundAuthInt = TRUE;
|
||||
}
|
||||
token = strtok_r(NULL, ",", &tok_buf);
|
||||
token = Curl_strtok_r(NULL, ",", &tok_buf);
|
||||
}
|
||||
|
||||
free(tmp);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue