From c7a44c46901a39ae02c1c0cb149b6c835c17d086 Mon Sep 17 00:00:00 2001 From: Simon Kelley Date: Tue, 7 Jan 2020 20:30:16 +0000 Subject: [PATCH] Revert tftp block number overflow check. Wrapping block nos is fine. --- src/tftp.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/tftp.c b/src/tftp.c index ca6676a..4c18577 100644 --- a/src/tftp.c +++ b/src/tftp.c @@ -602,13 +602,7 @@ void check_tftp_listeners(time_t now) /* we overwrote the buffer... */ daemon->srv_save = NULL; - /* check for wrap of 16 bit block no. */ - if (transfer->block == 0x10000) - { - len = tftp_err(ERR_ILL, daemon->packet, _("too many blocks"), NULL); - endcon = 1; - } - else if ((len = get_block(daemon->packet, transfer)) == -1) + if ((len = get_block(daemon->packet, transfer)) == -1) { len = tftp_err_oops(daemon->packet, transfer->file->filename); endcon = 1; @@ -741,8 +735,7 @@ static ssize_t tftp_err(int err, char *packet, char *message, char *file) char *errstr = strerror(errno); memset(packet, 0, daemon->packet_buff_sz); - if (file) - sanitise(file); + sanitise(file); mess->op = htons(OP_ERR); mess->err = htons(err);