From: Joseph C. Lehner Date: Mon, 29 Apr 2019 08:51:38 +0000 (+0200) Subject: Prevent block counter rollover X-Git-Tag: v0.9.14~18 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=49b156879aa32332adbec94e0a21c37b8b4485a1;p=oweals%2Fnmrpflash.git Prevent block counter rollover --- 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);