mirror of https://github.com/moparisthebest/curl
strtok() replaced with strtok_r()
This commit is contained in:
parent
e0558ae541
commit
d567659bf4
|
@ -199,6 +199,7 @@ Curl_cookie_add(struct CookieInfo *c,
|
|||
/* This line is NOT a HTTP header style line, we do offer support for
|
||||
reading the odd netscape cookies-file format here */
|
||||
char *firstptr;
|
||||
char *tok_buf;
|
||||
int fields;
|
||||
|
||||
if(lineptr[0]=='#') {
|
||||
|
@ -214,7 +215,7 @@ Curl_cookie_add(struct CookieInfo *c,
|
|||
if(ptr)
|
||||
*ptr=0; /* clear it */
|
||||
|
||||
firstptr=strtok(lineptr, "\t"); /* first tokenize it on the TAB */
|
||||
firstptr=strtok_r(lineptr, "\t", &tok_buf); /* first tokenize it on the TAB */
|
||||
|
||||
/* Here's a quick check to eliminate normal HTTP-headers from this */
|
||||
if(!firstptr || strchr(firstptr, ':')) {
|
||||
|
@ -224,7 +225,7 @@ Curl_cookie_add(struct CookieInfo *c,
|
|||
|
||||
/* Now loop through the fields and init the struct we already have
|
||||
allocated */
|
||||
for(ptr=firstptr, fields=0; ptr; ptr=strtok(NULL, "\t"), fields++) {
|
||||
for(ptr=firstptr, fields=0; ptr; ptr=strtok_r(NULL, "\t", &tok_buf), fields++) {
|
||||
switch(fields) {
|
||||
case 0:
|
||||
co->domain = strdup(ptr);
|
||||
|
|
|
@ -111,8 +111,9 @@ int Curl_parsenetrc(char *host,
|
|||
file = fopen(netrcbuffer, "r");
|
||||
if(file) {
|
||||
char *tok;
|
||||
char *tok_buf;
|
||||
while(fgets(netrcbuffer, sizeof(netrcbuffer), file)) {
|
||||
tok=strtok(netrcbuffer, " \t\n");
|
||||
tok=strtok_r(netrcbuffer, " \t\n", &tok_buf);
|
||||
while(tok) {
|
||||
switch(state) {
|
||||
case NOTHING:
|
||||
|
@ -163,7 +164,7 @@ int Curl_parsenetrc(char *host,
|
|||
}
|
||||
break;
|
||||
} /* switch (state) */
|
||||
tok = strtok(NULL, " \t\n");
|
||||
tok = strtok_r(NULL, " \t\n", &tok_buf);
|
||||
} /* while (tok) */
|
||||
} /* while fgets() */
|
||||
|
||||
|
|
|
@ -1560,6 +1560,7 @@ static CURLcode Connect(struct UrlData *data,
|
|||
* checked if the lowercase versions don't exist.
|
||||
*/
|
||||
char *no_proxy=NULL;
|
||||
char *no_proxy_tok_buf;
|
||||
char *proxy=NULL;
|
||||
char proxy_env[128];
|
||||
|
||||
|
@ -1571,7 +1572,7 @@ static CURLcode Connect(struct UrlData *data,
|
|||
/* NO_PROXY wasn't specified or it wasn't just an asterisk */
|
||||
char *nope;
|
||||
|
||||
nope=no_proxy?strtok(no_proxy, ", "):NULL;
|
||||
nope=no_proxy?strtok_r(no_proxy, ", ", &no_proxy_tok_buf):NULL;
|
||||
while(nope) {
|
||||
if(strlen(nope) <= strlen(conn->name)) {
|
||||
char *checkn=
|
||||
|
@ -1581,7 +1582,7 @@ static CURLcode Connect(struct UrlData *data,
|
|||
break;
|
||||
}
|
||||
}
|
||||
nope=strtok(NULL, ", ");
|
||||
nope=strtok_r(NULL, ", ", &no_proxy_tok_buf);
|
||||
}
|
||||
if(!nope) {
|
||||
/* It was not listed as without proxy */
|
||||
|
|
Loading…
Reference in New Issue