From 49b156879aa32332adbec94e0a21c37b8b4485a1 Mon Sep 17 00:00:00 2001 From: "Joseph C. Lehner" Date: Mon, 29 Apr 2019 10:51:38 +0200 Subject: [PATCH] Prevent block counter rollover --- tftp.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tftp.c b/tftp.c index 06258dc..f81f877 100644 --- a/tftp.c +++ b/tftp.c @@ -400,9 +400,8 @@ int tftp_put(struct nmrpd_args *args) if (timeouts || ackblock == block) { if (!timeouts) { - if (++block == 0) { - // rollover; skip to block 1 - block = 1; + if (block < UINT16_MAX) { + ++block; } pkt_mknum(tx, DATA); -- 2.25.1