Coverity rightfully complains about inproper use of negative value.
maxlength special value '-1' should be handled appropriately.
Change-Id: Ie1818121e39fa668094d012980016444ca868e6e
Reviewed-on: https://code.wireshark.org/review/13978
Reviewed-by: João Valverde <j@v6e.pt>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
THROW(exception);
/* Only search to end of tvbuff, w/o throwing exception. */
- if (limit > (guint) maxlength) {
+ if (maxlength >= 0 && limit > (guint) maxlength) {
/* Maximum length doesn't go past end of tvbuff; search
to that value. */
- limit = maxlength;
+ limit = (guint) maxlength;
}
/* If we have real data, perform our search now. */