From 2d4a5948fc28e897fa9c2c48545106bb6d28793b Mon Sep 17 00:00:00 2001 From: "Joseph C. Lehner" Date: Fri, 26 Apr 2019 20:43:45 +0200 Subject: [PATCH] Fix tftp block rollover --- tftp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tftp.c b/tftp.c index de8f765..06258dc 100644 --- a/tftp.c +++ b/tftp.c @@ -400,8 +400,10 @@ int tftp_put(struct nmrpd_args *args) if (timeouts || ackblock == block) { if (!timeouts) { - // TODO: set block to 1 if ++block == 0 ? - ++block; + if (++block == 0) { + // rollover; skip to block 1 + block = 1; + } pkt_mknum(tx, DATA); pkt_mknum(tx + 2, block); -- 2.25.1