lftp-devel  

Re: HTTP parse_html null target

R. Wajda
Wed, 02 Jan 2008 02:00:04 -0800

Dear lftp-devel list,

first patch fixed only one specific NULL-pointer case, v2 patch fixes
several.

Regards,
RW
--- HttpDir.cc_3.6.1    2008-01-02 10:12:50.000000000 +0100
+++ HttpDir.cc  2008-01-02 10:49:15.000000000 +0100
@@ -691,6 +691,9 @@
    if(tag_scan->tag==0)
       return tag_len;  // not interesting
 
+   if(link_target.length()==0)
+      return tag_len;   // no target ?
+
    const char *prefix_proto=0;
    if(prefix)
       prefix_proto=prefix->proto;
@@ -766,8 +769,6 @@
    if(strchr(link_target,'?'))
       return tag_len;  // cgi
    link_target.truncate_at('#'); // strip the anchor
-   if(link_target.length()==0)
-      return tag_len;  // no target ?
 
    // netscape internal icons
    if(icon && !strncasecmp(link_target,"internal-gopher",15))