From: Joseph C. Lehner Date: Fri, 26 Apr 2019 18:43:45 +0000 (+0200) Subject: Fix tftp block rollover X-Git-Tag: v0.9.14~20 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=2d4a5948fc28e897fa9c2c48545106bb6d28793b;p=oweals%2Fnmrpflash.git Fix tftp block rollover --- 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);