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:
@@ -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 */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user