[core] Fix wrapping of tftp block index
authorDavid Edmondson <dme@dme.org>
Thu, 22 Jan 2009 17:19:21 +0000 (12:19 -0500)
committerMarty Connor <mdc@etherboot.org>
Thu, 22 Jan 2009 17:19:21 +0000 (12:19 -0500)
Handle wrapping of the tftp block index correctly by ensuring that we
compare unsigned shorts when examining block index numbers.

Signed-off-by: Marty Connor <mdc@etherboot.org>
src/core/nic.c

index 6aaa8e2..90dec41 100644 (file)
@@ -828,7 +828,7 @@ int tftp_block ( struct tftpreq_info_t *request, struct tftpblk_info_t *block )
                        }
                } break;
                case TFTP_DATA :
-                       if ( ntohs(rcvd->u.data.block) != ( blockidx + 1 ) )
+                       if ( ntohs(rcvd->u.data.block) != (unsigned short)( blockidx + 1 ) )
                                break; /* Re-ACK last block sent */
                        if ( recvlen > ( blksize+sizeof(rcvd->u.data.block) ) )
                                break; /* Too large; ignore */