From: Guilherme Maciel Ferreira Date: Sat, 24 Dec 2011 14:06:41 +0000 (-0200) Subject: Fix: handling packets with options length equal to zero. X-Git-Tag: v1.3~22 X-Git-Url: http://developer.intra2net.com/git/?a=commitdiff_plain;h=ff9fdbd32f7e71a98c69017a3ebbe102dceb6c45;p=pingcheck Fix: handling packets with options length equal to zero. --- diff --git a/src/ip/ipv4header.cpp b/src/ip/ipv4header.cpp index 7c13490..1c0dc22 100644 --- a/src/ip/ipv4header.cpp +++ b/src/ip/ipv4header.cpp @@ -232,7 +232,7 @@ istream &operator>>( GlobalLogger.error() << "Error: invalid IP options length value." << endl; is.setstate( ios::failbit ); } - else + else if ( ( 0 < options_length ) && ( options_length <= 40 ) ) { size_t options_size = static_cast( options_length ); scoped_array options_data( new uint8_t[options_size] ); @@ -242,6 +242,10 @@ istream &operator>>( header.Payload.append( options_data.get(), options_size ); } + else // ( options_length == 0 ) + { + //GlobalLogger.info() << "Info: No options available in this packet." << endl; + } return is; }