On 21/10/14 01:20, Gabriel Somlo wrote:
Hi Giuseppe,

I think I found a regression in the development branch of wget, which
wasn't present in 1.15. Using "git bisect", it appears the offending
commit was 8e6de1fb5ff0ca0c749da7db634a1b1e3a1215a2 ("Drop usage of
strncpy") from Jun. 9 2014.

To reproduce, grab a "wide and shallow" copy of wikipedia.org, like so:


   wget -rpkEHN -e robots=off --random-wait -t 2 -U mozilla -l 1 \
        -P ./vservers wikipedia.org


then (some 20 minutes or so later) open ./vservers/wikipedia.org/index.html
in your (firefox-32.0.2-1.fc20.x86_64) browser as a file.

Before commit 8e6de1fb5ff0ca0c749da7db634a1b1e3a1215a2, the page looks
normal. After said commit, it looks (for me) like in the attached
screenshot.

I couldn't revert the commit, as subsequent changes have accumulated
since it was applied. I'm also relatively new to the code base, so
figuring out exactly what went wrong might be significantly faster
for you :)

I can (if necessary) open a ticket in the bug tracker (e.g. for a
better place to upload the screenshot, which may not make it through
on the mailing list), just let me know what you think.

Thanks much,
--Gabriel
Thanks for your report!

After a quick look, get_uri_string seems to not be taking into account the end of the url() parameter (it was before 8e6de1fb5).
Can you check if this patch fixes the issue?

diff --git a/src/css-url.c b/src/css-url.c
index c605798..34a20af 100644
--- a/src/css-url.c
+++ b/src/css-url.c
@@ -72,6 +72,8 @@ extern int yylex (void);
 static char *
 get_uri_string (const char *at, int *pos, int *length)
 {
+  char *uri;
+
   if (0 != strncasecmp (at + *pos, "url(", 4))
     return NULL;

@@ -97,7 +99,14 @@ get_uri_string (const char *at, int *pos, int *length)
       *length -= 2;
     }

-  return xstrdup (at + *pos);
+  uri = xmalloc (*length + 1);
+  if (uri)
+    {
+      strncpy (uri, at + *pos, *length);
+      uri[*length] = '\0';
+    }
+
+  return uri;
 }

 void



Reply via email to