[PATCH] wget: removed pointless free, fixes bug accessing freed memory

gotrunks at gmail.com gotrunks at gmail.com
Sun Mar 20 20:31:30 UTC 2011


On Sun, Mar 20, 2011 at 4:21 PM, Denys Vlasenko
<vda.linux at googlemail.com> wrote:
> On Tuesday 15 March 2011 03:07, gotrunks at gmail.com wrote:
>> Hi,
>>
>> I have just noticed a recent wget bug. Busybox wget doesn't parse the
>> URL correctly in some circumstances; long guessed output filenames &&
>> HTTP redirection.
>>
>> e.g.
>> $./busybox wget
>> http://cdimage.debian.org/debian-cd/6.0.0/kfreebsd-i386/iso-cd/debian-6.0.0-kfreebsd-i386-CD-1.iso
>> Connecting to cdimage.debian.org (130.239.18.173:80)
>> Connecting to hammurabi.acc.umu.se (130.239.18.165:80)
>> wget: can't open '': No such file or directory
>
> Can't reproduce. What causes this on your machine?
>
>

Like Cristian says, now there's a 404 error. Debian 6.0.1 was released
yesterday... the return was:
wget: can't open '': No such file or directory
wget tried to output to "".

If I try with other url (current iso of debian), wget tries to output to:
ebian-6.0.1-kfreebsd-i386-CD-1.iso (first letter of filename is missing)

./busybox wget http://cdimage.debian.org/debian-cd/6.0.1/kfreebsd-i386/iso-cd/debian-6.0.1-kfreebsd-i386-CD-1.iso
Connecting to cdimage.debian.org (130.239.18.163:80)
Connecting to caesar.acc.umu.se (130.239.18.142:80)
ebian-6.0.1-kfreebsd   1% |                            |  7769k  1:34:38 ETA
^----------------------------- d is missing

[...]


> I don't want to leak target.allocated in this case.
> --
> vda
>

Ok.I did not understand why, but removing the free fixed the problem
for me. ¿? I'm using 1.19.git on linux x86 (glibc)

Wouldn't be better:
else {
	free(target.allocated);
	parse_url(str, &target);
	if (!use_proxy) {
		free(server.allocated);
		server.allocated = NULL;
...


Regards,
-- 
Pere


More information about the busybox mailing list