From 0bb6deda721796c8bf501c8bcbf86998b51f2828 Mon Sep 17 00:00:00 2001
From: Daniel Stenberg <daniel@haxx.se>
Date: Fri, 21 May 2010 23:07:59 +0200
Subject: [PATCH] TFTP: don't ack if wrong block num is received

If an unexpected block number was received, break out of the
switch loop.
---
 lib/tftp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/tftp.c b/lib/tftp.c
index 20e5fd5da5..1228297e05 100644
--- a/lib/tftp.c
+++ b/lib/tftp.c
@@ -599,11 +599,12 @@ static CURLcode tftp_rx(tftp_state_data_t *state, tftp_event_t event)
       infof(data,
             "Received unexpected DATA packet block %d\n", rblock);
       state->retries++;
-      if(state->retries>state->retry_max) {
+      if(state->retries > state->retry_max) {
         failf(data, "tftp_rx: giving up waiting for block %d",
               NEXT_BLOCKNUM(state->block));
         return CURLE_TFTP_ILLEGAL;
       }
+      break;
     }
     /* This is the expected block.  Reset counters and ACK it. */
     state->block = (unsigned short)rblock;
-- 
GitLab