Revert "Prevent block counter rollover"
authorJoseph C. Lehner <joseph.c.lehner@gmail.com>
Thu, 5 Sep 2019 13:26:23 +0000 (15:26 +0200)
committerJoseph C. Lehner <joseph.c.lehner@gmail.com>
Thu, 5 Sep 2019 13:26:23 +0000 (15:26 +0200)
This reverts commit 49b156879aa32332adbec94e0a21c37b8b4485a1.

tftp.c

diff --git a/tftp.c b/tftp.c
index f81f877938309fc9d2e6611832b2b0aaf7b057f4..06258dc4259e6967e6cf0fae71000b2a44e729cf 100644 (file)
--- a/tftp.c
+++ b/tftp.c
@@ -400,8 +400,9 @@ int tftp_put(struct nmrpd_args *args)
 
                if (timeouts || ackblock == block) {
                        if (!timeouts) {
-                               if (block < UINT16_MAX) {
-                                       ++block;
+                               if (++block == 0) {
+                                       // rollover; skip to block 1
+                                       block = 1;
                                }
 
                                pkt_mknum(tx, DATA);