From: Mike Stepanek (mstepane) Date: Wed, 11 May 2022 18:20:47 +0000 (+0000) Subject: Pull request #3418: JS Normalizer: A Source Field Availability X-Git-Tag: 3.1.30.0~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=33b60d00d7bd26659890fd010409f57b33ba662e;p=thirdparty%2Fsnort3.git Pull request #3418: JS Normalizer: A Source Field Availability Merge in SNORT/snort3 from ~OSHUMEIK/snort3:js_input_check to master Squashed commit of the following: commit 33b91f2ba4c20d634ec0bab28b76f46bdb0e5efc Author: Oleksii Shumeiko Date: Tue May 10 14:48:58 2022 +0300 http_inspect: check if input available before JavaScript normalization --- diff --git a/src/service_inspectors/http_inspect/http_msg_body.cc b/src/service_inspectors/http_inspect/http_msg_body.cc index 151530257..3aa4b0269 100644 --- a/src/service_inspectors/http_inspect/http_msg_body.cc +++ b/src/service_inspectors/http_inspect/http_msg_body.cc @@ -582,6 +582,12 @@ const Field& HttpMsgBody::get_norm_js_data() if (norm_js_data.length() != STAT_NOT_COMPUTE) return norm_js_data; + if (decompressed_file_body.length() <= 0) + { + norm_js_data.set(STAT_NO_SOURCE); + return norm_js_data; + } + do_enhanced_js_normalization(decompressed_file_body, norm_js_data); if (norm_js_data.length() == STAT_NOT_COMPUTE)