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.
This commit is contained in:
Daniel Stenberg
2007-05-17 21:40:08 +00:00
parent 0427e94465
commit 8479785620
3 changed files with 10 additions and 1 deletions

View File

@@ -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)