From 5613783ce89ed5ab2a9820cf702d2c7a3b16171e Mon Sep 17 00:00:00 2001 From: patacongo Date: Mon, 12 Dec 2011 15:59:33 +0000 Subject: STM32 Ethernet... initial bring-up changes git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4165 42af7a65-404d-4744-a932-0658087f49c3 --- apps/netutils/tftpc/tftpc_get.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'apps/netutils') diff --git a/apps/netutils/tftpc/tftpc_get.c b/apps/netutils/tftpc/tftpc_get.c index f4fb74dd3..bfae1a3b7 100644 --- a/apps/netutils/tftpc/tftpc_get.c +++ b/apps/netutils/tftpc/tftpc_get.c @@ -256,10 +256,19 @@ int tftpget(const char *remote, const char *local, in_addr_t addr, bool binary) /* Parse the incoming DATA packet */ - if (nbytesrecvd < TFTP_DATAHEADERSIZE || - tftp_parsedatapacket(packet, &opcode, &rblockno) != OK || + if (nbytesrecvd < TFTP_DATAHEADERSIZE) + { + /* Packet is not big enough to be parsed */ + + nvdbg("Tiny data packet ignored\n"); + continue; + } + + if (tftp_parsedatapacket(packet, &opcode, &rblockno) != OK || blockno != rblockno) { + /* Opcode is not TFTP_DATA or the block number is unexpected */ + nvdbg("Parse failure\n"); if (opcode > TFTP_MAXRFC1350) { -- cgit v1.2.3