cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-tracker mailing list Archives

[ curl-Bugs-1715392 ] TFTP catches float point exception with "--connect-timeout"

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Thu, 17 May 2007 14:40:28 -0700

Bugs item #1715392, was opened at 2007-05-09 04:34
Message generated for change (Comment added) made by bagder
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=1715392&group_id=976

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: TFTP
Group: crash
>Status: Closed
>Resolution: Fixed
Priority: 6
Private: No
Submitted By: Feng Tu (ayanamixp)
Assigned to: Daniel Stenberg (bagder)
Summary: TFTP catches float point exception with "--connect-timeout"

Initial Comment:
When the option "--connect-timeout" is followed by the number less than 5, Curl will catches float point exception.
You can type the command as followings:
$ curl tftp://%HOSTIP:%TFTPPORT/1.txt --connect-timeout 1
You will get an error like this:
Floating point exception

We find the reason causing this defect:
In function "tftp_set_timeouts" of the file "lib/tftp.c"

================================================
state->retry_max = timeout/5;
/* Compute the re-start interval to suit the timeout */
state->retry_time = timeout/state->retry_max;

================================================

When variant "timeout" is less than 5, we will get an arithmetic expression of which denominator is zero!!
Kenerl will send signal "SIGFPE" and terminate program.

I think we can solve this defect by adding
================================================
        state->retry_max = timeout/5;
+ if ( state->retry_max < 1 ){
+ state->retry_max = 1;
+ }

        /* Compute the re-start interval to suit the timeout */
        state->retry_time = timeout/state->retry_max;
================================================

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

>Comment By: Daniel Stenberg (bagder)
Date: 2007-05-17 23:40

Message:
Logged In: YES
user_id=1110
Originator: NO

Thanks a lot, this fix has now been applied in CVS!

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

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=1715392&group_id=976
Received on 2007-05-17

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET