aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2007-05-17 21:40:08 +0000
committerDaniel Stenberg <daniel@haxx.se>2007-05-17 21:40:08 +0000
commit8479785620e17ec64e51765d4d54d74e574c23b1 (patch)
treeb284ea0d10ece7d0333c01ae9fa1a22e1f0ffe33
parent0427e94465661ef1b8127c3cd483dc5ffab04f2a (diff)
Feng Tu pointed out a division by zero error in the TFTP connect timeout
code for timeouts less than fice seconds, and also provided a fix for it.
-rw-r--r--CHANGES4
-rw-r--r--RELEASE-NOTES3
-rw-r--r--lib/tftp.c4
3 files changed, 10 insertions, 1 deletions
diff --git a/CHANGES b/CHANGES
index d8970714e..748597619 100644
--- a/CHANGES
+++ b/CHANGES
@@ -5,6 +5,10 @@
\___|\___/|_| \_\_____|
Changelog
+Daniel S (17 May 2007)
+- Feng Tu pointed out a division by zero error in the TFTP connect timeout
+ code for timeouts less than fice seconds, and also provided a fix for it.
+
Dan F (16 May 2007)
- Added support for compiling under Minix 3.1.3 using ACK.
diff --git a/RELEASE-NOTES b/RELEASE-NOTES
index cc9053c87..a99410c8c 100644
--- a/RELEASE-NOTES
+++ b/RELEASE-NOTES
@@ -43,6 +43,7 @@ This release includes the following bugfixes:
o better handling of out of memory conditions
o overwriting an uploaded file with sftp now truncates it first
o SFTP quote commands chmod, chown, chgrp can now set a value of 0
+ o TFTP connect timouts less than 5 seconds
This release includes the following known bugs:
@@ -67,6 +68,6 @@ advice from friends like these:
Song Ma, Dan Fandrich, Yang Tse, Jay Austin, Robert Iakobashvil,
James Housley, Daniel Black, Steve Little, Sonia Subramanian, Peter O'Gorman,
Frank Hempel, Michael Wallner, Jeff Pohlmeyer, Tobias Rundström,
- Anders Gustafsson, James Bursa, Kristian Gunstone
+ Anders Gustafsson, James Bursa, Kristian Gunstone, Feng Tu
Thanks! (and sorry if I forgot to mention someone)
diff --git a/lib/tftp.c b/lib/tftp.c
index 18c9472d3..c203f4fdf 100644
--- a/lib/tftp.c
+++ b/lib/tftp.c
@@ -180,6 +180,10 @@ void tftp_set_timeouts(tftp_state_data_t *state)
/* Average restart after 5 seconds */
state->retry_max = timeout/5;
+ if(state->retry_max < 1)
+ /* avoid division by zero below */
+ state->retry_max = 1;
+
/* Compute the re-start interval to suit the timeout */
state->retry_time = timeout/state->retry_max;
if(state->retry_time<1)