http://git.etherboot.org
/
people
/
cooldavid
/
gpxe.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e65afc4
)
[tftp] Guard against invalid data block numbers
author
Michael Brown
<mcb30@etherboot.org>
Sun, 1 Feb 2009 13:07:17 +0000
(13:07 +0000)
committer
Michael Brown
<mcb30@etherboot.org>
Sun, 1 Feb 2009 13:07:17 +0000
(13:07 +0000)
A TFTP DATA packet with a block number of zero (representing a
negative offset within the file) could potentially cause problems.
Fixed by explicitly rejecting such packets.
Identified by Stefan Hajnoczi <stefanha@gmail.com>.
src/net/udp/tftp.c
patch
|
blob
|
history
diff --git
a/src/net/udp/tftp.c
b/src/net/udp/tftp.c
index
889362a
..
13734b0
100644
(file)
--- a/
src/net/udp/tftp.c
+++ b/
src/net/udp/tftp.c
@@
-741,6
+741,11
@@
static int tftp_rx_data ( struct tftp_request *tftp,
rc = -EINVAL;
goto done;
}
+ if ( data->block == 0 ) {
+ DBGC ( tftp, "TFTP %p received data block 0\n", tftp );
+ rc = -EINVAL;
+ goto done;
+ }
/* Extract data */
block = ( ntohs ( data->block ) - 1 );