diff options
| author | Michael Brown | 2007-09-09 14:31:38 +0200 |
|---|---|---|
| committer | Michael Brown | 2007-09-09 14:31:38 +0200 |
| commit | 98de16befd50b2922a8c26ba2a0f447a738adac2 (patch) | |
| tree | cb7af4412ea7ee3ec670265b7d7d7bfec38cdff3 /src/net/udp | |
| parent | Add the possibility to create .o files from arbitrary binary blobs. (diff) | |
| parent | Use "/bin/echo -e" instead of shell builtin echo; some shells don't (diff) | |
| download | ipxe-98de16befd50b2922a8c26ba2a0f447a738adac2.tar.gz ipxe-98de16befd50b2922a8c26ba2a0f447a738adac2.tar.xz ipxe-98de16befd50b2922a8c26ba2a0f447a738adac2.zip | |
Merge branch 'master' of rom.etherboot.org:/pub/scm/gpxe
Diffstat (limited to 'src/net/udp')
| -rw-r--r-- | src/net/udp/tftp.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/net/udp/tftp.c b/src/net/udp/tftp.c index 74c8c0a5f..194c533d6 100644 --- a/src/net/udp/tftp.c +++ b/src/net/udp/tftp.c @@ -415,7 +415,7 @@ static int tftp_rx_oack ( struct tftp_request *tftp, void *buf, size_t len ) { static int tftp_rx_data ( struct tftp_request *tftp, struct io_buffer *iobuf ) { struct tftp_data *data = iobuf->data; - unsigned int block; + int block; size_t data_len; int rc; @@ -432,6 +432,14 @@ static int tftp_rx_data ( struct tftp_request *tftp, iob_pull ( iobuf, sizeof ( *data ) ); data_len = iob_len ( iobuf ); + /* Check for correct block */ + if ( block != ( tftp->state + 1 ) ) { + DBGC ( tftp, "TFTP %p received out-of-order block %d " + "(expecting %d)\n", tftp, block, ( tftp->state + 1 ) ); + free_iob ( iobuf ); + return 0; + } + /* Deliver data */ if ( ( rc = xfer_deliver_iob ( &tftp->xfer, iobuf ) ) != 0 ) { DBGC ( tftp, "TFTP %p could not deliver data: %s\n", |
