Skip to content

Commit 856818c

Browse files
committed
Bound TFTP transfer mode parsing to received packet
1 parent ee7043a commit 856818c

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/tftp/wolftftp.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,8 @@ static int wolftftp_parse_request(const uint8_t *buf, uint16_t len,
339339
return WOLFTFTP_ERR_PACKET;
340340
p += slen + 1U;
341341
slen = wolftftp_strnlen_local(p, (size_t)(buf + len - (const uint8_t *)p));
342-
if (slen == 0 || wolftftp_stricmp_local(p, "octet") != 0)
342+
if (slen == 0 || (const uint8_t *)(p + slen) >= buf + len ||
343+
wolftftp_stricmp_local(p, "octet") != 0)
343344
return WOLFTFTP_ERR_UNSUPPORTED;
344345
p += slen + 1U;
345346

0 commit comments

Comments
 (0)