[PATCH 2/3] tftp_recv(): according to RFC1350 minimal tftp packet length is 4 bytes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Antony Pavlov <antonynpavlov@xxxxxxxxx>
---
 fs/tftp.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/tftp.c b/fs/tftp.c
index d970c60..e36c1c8 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);
 
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux