Expand a variable from 16 to 32 bits (and make it signed).

Fixes an overflow leading to infinite loop.

Bug: 10259
Change-Id: Ie76c5a810af927ba092f4067268bd789b3a7d7bf
Reviewed-on: https://code.wireshark.org/review/2856
Reviewed-by: Evan Huus <eapache@gmail.com>
(cherry picked from commit c92bf7e44bae7d73b65461b7fb5bf9cea72705ce)
Reviewed-on: https://code.wireshark.org/review/2857