HTTP parse_html null target
"R. Wajda" <[email protected]> Wed, 02 Jan 2008 10:20:36 +0100
| Newsgroups | gmane.network.lftp.devel |
|---|---|
| Message-ID | <[email protected]> |
Dear lftp-devel list,
empty target in a link causes lftp to generate coredump.
E.g.:
#0 0xb7ca0783 in strchr () from /lib/tls/libc.so.6
#1 0x080d2a81 in parse_html (buf=0x8175410 "<a href=\"\">bar</a>\n",
buf_len=21, eof=false,
list=@0x8174f68, set=0x0, all_links=0x8174f80, prefix=0x8149190,
base_href=0x8174fac,
lsopt=0x8174fb0, color=1) at HttpDir.cc:766
#2 0x080d47e4 in HttpDirList::Do (this=0x8174f38) at HttpDir.cc:1239
#3 0x080811b7 in SMTask::Schedule () at SMTask.cc:226
#4 0x08053dfb in Job::WaitDone (this=0x812ddc0) at Job.cc:522
#5 0x0804dbdc in main (argc=2, argv=0xbff131c4) at lftp.cc:466
Patch included.
Regards,
RW
lftp_http_null_target.patch
(text/plain, 604 B)
--- HttpDir.cc_3.6.1 2008-01-02 10:12:50.000000000 +0100
+++ HttpDir.cc 2008-01-02 10:06:37.000000000 +0100
@@ -762,12 +762,12 @@
&& !strcasecmp(tag_scan->link,"href"))
a_href=true;
+ if(link_target.length()==0)
+ return tag_len; // no target ?
// check if the target is a relative and not a cgi
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))