tftp: verify direction in a few places
No binary (build failed)
—
(log yok)
| @@ -366,6 +366,9 @@ static CURLcode tftp_tx(struct tftp_conn *state, tftp_event_t event) | |
| char *bufptr; | |
| bool eos; | |
| + | if(!data->state.upload) |
| + | return CURLE_TFTP_ILLEGAL; |
| + | |
| switch(event) { | |
| case TFTP_EVENT_ACK: | |
| @@ -773,10 +776,14 @@ static CURLcode tftp_send_first(struct tftp_conn *state, | |
| break; | |
| case TFTP_EVENT_ACK: /* Connected for transmit */ | |
| + | if(!data->state.upload) |
| + | return CURLE_TFTP_ILLEGAL; |
| result = tftp_connect_for_tx(state, event); | |
| break; | |
| case TFTP_EVENT_DATA: /* Connected for receive */ | |
| + | if(data->state.upload) |
| + | return CURLE_TFTP_ILLEGAL; |
| result = tftp_connect_for_rx(state, event); | |
| break; | |
| @@ -1077,6 +1084,8 @@ static CURLcode tftp_receive_packet(struct Curl_easy *data, | |
| switch(state->event) { | |
| case TFTP_EVENT_DATA: | |
| + | if(data->state.upload) |
| + | return CURLE_TFTP_ILLEGAL; |
| /* Do not pass to the client empty or retransmitted packets */ | |
| if(state->rbytes > 4 && | |
| (NEXT_BLOCKNUM(state->block) == getrpacketblock(&state->rpacket))) { | |