wget: fix access-to-ro memory
authorDenis Vlasenko <vda.linux@googlemail.com>
Sun, 18 Mar 2007 18:00:51 +0000 (18:00 -0000)
committerDenis Vlasenko <vda.linux@googlemail.com>
Sun, 18 Mar 2007 18:00:51 +0000 (18:00 -0000)
networking/wget.c

index cc768db8b6511089492b411f52e30bf1dfea19e1..e46539fd946cb541d0523e8fe98d3d55ab03f69c 100644 (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;