From: Michael Altizer (mialtize) Date: Sat, 14 Nov 2020 03:16:52 +0000 (+0000) Subject: Merge pull request #2612 in SNORT/snort3 from ~BRASTULT/snort3:byte_math_cursor_fix... X-Git-Tag: 3.0.3-5~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6992d5eef77da081fef800e86e316f4367e627e6;p=thirdparty%2Fsnort3.git Merge pull request #2612 in SNORT/snort3 from ~BRASTULT/snort3:byte_math_cursor_fix to master Squashed commit of the following: commit a24ffdb10189a6022716a9e9e7f5521c1604461e Author: Brandon Stultz Date: Tue Nov 10 13:18:23 2020 -0500 ips_options: don't move cursor in byte_math --- diff --git a/src/ips_options/ips_byte_math.cc b/src/ips_options/ips_byte_math.cc index 9b5405339..a65f6df8a 100644 --- a/src/ips_options/ips_byte_math.cc +++ b/src/ips_options/ips_byte_math.cc @@ -213,27 +213,18 @@ IpsOption::EvalStatus ByteMathOption::eval(Cursor& c, Packet* p) } // do the extraction - int ret, bytes_read; uint32_t value; if (!config.string_convert_flag) { - ret = byte_extract(endian, config.bytes_to_extract, ptr, start, end, &value); - if (ret < 0) + if (byte_extract(endian, config.bytes_to_extract, ptr, start, end, &value) < 0) return NO_MATCH; - - bytes_read = config.bytes_to_extract; } else { - ret = string_extract(config.bytes_to_extract, config.base, ptr, start, end, &value); - if (ret < 0) + if (string_extract(config.bytes_to_extract, config.base, ptr, start, end, &value) < 0) return NO_MATCH; - - bytes_read = ret; } - /* advance cursor */ - c.add_pos(bytes_read); if (config.bitmask_val != 0) {