cURL / Mailing Lists / curl-users / Single Mail

curl-users

[ curl-Bugs-653337 ] curl 7.10.2 crash if no dns server found

From: <noreply_at_sourceforge.net>
Date: Fri, 13 Dec 2002 08:56:20 -0800

Bugs item #653337, was opened at 2002-12-13 16:56
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=653337&group_id=976

Category: libcurl
Group: crash
Status: Open
Resolution: None
Priority: 5
Submitted By: Christopher R. Palmer (crpalmer13)
Assigned to: Daniel Stenberg (bagder)
Summary: curl 7.10.2 crash if no dns server found

Initial Comment:
On a redhat linux 7.2 system (kernel 2.4.18), curl 7.10.2
crashes when no dns server may be contacted.

The short version of this bug report is that the
gethostbyname_r function is called in a loop whenever it
returns EAGAIN, which it return if there is no DNS
server. Looping on EAGAIN is a change that was made
in version 7.10.2 and causes the crash. Following are
some more detailed instructions to reproduce and show
the problem:

To trigger the bug, I have the following /etc/resolve.conf

nameserver 127.0.0.1

(ie, the dns server is on the local machine) and make
sure that no dns server is actually running:

sudo /sbin/service named stop

then run curl for any URL

./curl 'http://yahoo.com'

and I get a core dump.

This does not occur with version 7.10.1. Looking at the
cvs diffs, it appears that Linux is returning EAGAIN
which causes curl to go into a loop. Adding:

fprintf(stderr, "Trying resolution: step_size = %d\n",
step_size);

to line 619 of hostip.c (just before the gethostbyname_r)
call to print out the buffer size shows that it is looping
until it crashes. The last bit of the output is:

Trying resolution: step_size = 16600
Segmentation fault (core dumped)

while the buffer is only 9000 bytes long....

I suspect that the patch for redhat 8 dns problems is not
a very good solution to those problems!

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=653337&group_id=976

-------------------------------------------------------
This sf.net email is sponsored by:
With Great Power, Comes Great Responsibility
Learn to use your power at OSDN's High Performance Computing Channel
http://hpc.devchannel.org/
Received on 2002-12-13