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