Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-commits: [Wireshark-commits] master 1c16705: TFTP: Repair block numbers truncated at 16 b

From: Wireshark code review <code-review-do-not-reply@xxxxxxxxxxxxx>
Date: Mon, 26 Nov 2018 08:07:17 +0000
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=1c167050623f4c22006fa19c9039b7438d551f0c
Submitter: "Anders Broman <a.broman58@xxxxxxxxx>"
Changed: branch: master
Repository: wireshark

Commits:

1c16705 by Darius Davis (darius@xxxxxxxxxx):

    TFTP: Repair block numbers truncated at 16 bits.
    
    The TFTP protocol uses 16-bit block numbers.  After block 65535, the block
    number simply wraps back to zero.  This change implements recovery of the bits
    lost from the upper end of the block number, allowing for correct tracking of
    block numbers in large TFTP transfers.  The resulting "Full Block Number" is
    added to the TFTP tree, marked as GENERATED; The "Full Block Number" is now
    used in all places which previously received the truncated 16-bit block number.
    An expert note is added when the block number at the protocol level is about to
    wrap around to zero.
    
    I chose to use 32 bits for the block numbers... even with the absolute-minimum
    blocksize (8 bytes), that allows for 32 GByte files to be correctly handled;
    With a more reasonable blocksize, it theoretically allows for files on the
    order of terabytes.
    
    Testing Done:  On macOS 10.12.6, built Wireshark, and examined a handful of
       TFTP packet captures in the GUI, including the transfer of a large file
       (115,836 blocks of 1,456 bytes each).  Observed that the packet info shows
       untruncated block numbers where previously the displayed block numbers would
       wrap back to zero after block number 65,535.  Constructed a few packet
       captures with bizarre sequences of block numbers, and observed that they
       were dissected as expected.  Checked that a display filter for "tftp.block"
       and "tftp.block.full" worked as expected.
    
    Bug: 15305
    Change-Id: Ic72ca49c975b1db76e8c5653e64e2a7c34eede5d
    Reviewed-on: https://code.wireshark.org/review/30775
    Reviewed-by: Jaap Keuter <jaap.keuter@xxxxxxxxx>
    Petri-Dish: Jaap Keuter <jaap.keuter@xxxxxxxxx>
    Tested-by: Petri Dish Buildbot
    Reviewed-by: Anders Broman <a.broman58@xxxxxxxxx>
    

Actions performed:

    from  afd4216   CMake: Fix runtime destination for our libraries
     add  1c16705   TFTP: Repair block numbers truncated at 16 bits.


Summary of changes:
 epan/dissectors/packet-tftp.c | 75 ++++++++++++++++++++++++++++++++++++-------
 1 file changed, 63 insertions(+), 12 deletions(-)