wget: fix access-to-ro memory

1_4_stable
Denis Vlasenko 2007-03-18 18:00:51 +00:00
parent 5483a19fc3
commit d60a279c34
1 changed files with 3 additions and 1 deletions

View File

@ -543,7 +543,9 @@ static void parse_url(char *src_url, struct host_info *h)
p = strchr(h->host, '?'); if (!sp || (p && sp > p)) sp = p;
p = strchr(h->host, '#'); if (!sp || (p && sp > p)) sp = p;
if (!sp) {
h->path = "";
/* must be writable because of bb_get_last_path_component() */
static char nullstr[] = "";
h->path = nullstr;
} else if (*sp == '/') {
*sp = '\0';
h->path = sp + 1;