mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-13 06:33:44 +01:00
put my fenceposts back in valid memory space
svn:r2381
This commit is contained in:
parent
a2517b4f07
commit
6e7e880438
@ -284,14 +284,13 @@ parse_http_url(char *headers, char **url)
|
|||||||
s = (char *)eat_whitespace_no_nl(s);
|
s = (char *)eat_whitespace_no_nl(s);
|
||||||
if (!*s) return -1;
|
if (!*s) return -1;
|
||||||
start = s; /* this is it, assuming it's valid */
|
start = s; /* this is it, assuming it's valid */
|
||||||
s = (char *)find_whitespace(s);
|
s = (char *)find_whitespace(start);
|
||||||
if (!*s) return -1;
|
if (!*s) return -1;
|
||||||
*s = 0;
|
|
||||||
if(s-start < 5 || strcmpstart(start,"/tor/")) { /* need to rewrite it */
|
if(s-start < 5 || strcmpstart(start,"/tor/")) { /* need to rewrite it */
|
||||||
*url = tor_malloc(s - start + 5);
|
*url = tor_malloc(s - start + 5);
|
||||||
strcpy(*url,"/tor");
|
strcpy(*url,"/tor");
|
||||||
strlcpy(*url+4, start, s-start+1);
|
strlcpy((*url)+4, start, s-start+1);
|
||||||
*url[s-start+4] = 0; /* null terminate it */
|
(*url)[s-start+4] = 0; /* null terminate it */
|
||||||
} else {
|
} else {
|
||||||
*url = tor_strndup(start, s-start);
|
*url = tor_strndup(start, s-start);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user