summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/tftp.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/tftp.c b/fs/tftp.c
index d970c601b9..e36c1c8a41 100644
--- a/fs/tftp.c
+++ b/fs/tftp.c
@@ -259,7 +259,8 @@ static void tftp_recv(struct file_priv *priv,
uint16_t proto;
uint16_t *s;
- if (len < 2)
+ /* according to RFC1350 minimal tftp packet length is 4 bytes */
+ if (len < 4)
return;
len -= 2;
@@ -315,8 +316,6 @@ static void tftp_recv(struct file_priv *priv,
break;
case TFTP_DATA:
- if (len < 2)
- return;
len -= 2;
priv->block = ntohs(*(uint16_t *)pkt);