cURL / Mailing Lists / curl-users / Single Mail

curl-users

uninitialized variable in main.c

From: David Byron <DByron_at_everdreamcorp.com>
Date: Thu, 11 Mar 2004 18:20:01 -0800

I think I must have just gotten lucky, but I found a bug in main.c
concerning outs.filename in operate().

>From what I can tell, outs.filename only gets assigned if
config->resume_from is 0. Later on, if config->remote_time is true and
outs.filename isn't NULL, outs.filename gets used as thr argument to the
utime functions.

I think that means that:

$ echo blah >foo
$ ./curl --remote-time --output foo --continue-at - http://www.google.com

is rolling the dice with outs.filename. It happens that google doesn't seem
to support byte ranges, so this command doesn't crash, but hopefully this is
enough for people to duplicate what I'm seeing.

I do have a reliable failure (a crash at the utime call), but it only seems
to happen in my environment, after a pretty hairy sequence of calls, etc.

The attached patch makes the crash go away by initializing outs to 0 at the
beginning. I'm comfortable with that part. I think the rest of the patch
is also required so that curl sets the time on the file as requested but I
haven't been able to totally verify this.

$ ./curl --version
curl 7.11.0-CVS (win32) libcurl/7.11.0-CVS
Protocols: ftp gopher telnet dict ldap http file
Features: Largefile

Thanks for your help.

-DB

Received on 2004-03-12