INFILESIZE: fields in UserDefined must not be changed run-time

set.infilesize in this case was modified in several places, which could
lead to repeated requests using the same handle to get unintendent/wrong
consequences based on what the previous request did!
This commit is contained in:
Daniel Stenberg
2014-04-15 13:49:18 +02:00
parent 9c941e92c4
commit d5ec44ca4c
13 changed files with 57 additions and 51 deletions

View File

@@ -477,8 +477,8 @@ static CURLcode tftp_send_first(tftp_state_data_t *state, tftp_event_t event)
setpacketevent(&state->spacket, TFTP_EVENT_WRQ);
state->conn->data->req.upload_fromhere =
(char *)state->spacket.data+4;
if(data->set.infilesize != -1)
Curl_pgrsSetUploadSize(data, data->set.infilesize);
if(data->state.infilesize != -1)
Curl_pgrsSetUploadSize(data, data->state.infilesize);
}
else {
/* If we are downloading, send an RRQ */
@@ -498,9 +498,9 @@ static CURLcode tftp_send_first(tftp_state_data_t *state, tftp_event_t event)
sbytes = 4 + strlen(filename) + strlen(mode);
/* add tsize option */
if(data->set.upload && (data->set.infilesize != -1))
if(data->set.upload && (data->state.infilesize != -1))
snprintf(buf, sizeof(buf), "%" CURL_FORMAT_CURL_OFF_T,
data->set.infilesize);
data->state.infilesize);
else
strcpy(buf, "0"); /* the destination is large enough */