]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Pull request #3418: JS Normalizer: A Source Field Availability
authorMike Stepanek (mstepane) <mstepane@cisco.com>
Wed, 11 May 2022 18:20:47 +0000 (18:20 +0000)
committerMike Stepanek (mstepane) <mstepane@cisco.com>
Wed, 11 May 2022 18:20:47 +0000 (18:20 +0000)
Merge in SNORT/snort3 from ~OSHUMEIK/snort3:js_input_check to master

Squashed commit of the following:

commit 33b91f2ba4c20d634ec0bab28b76f46bdb0e5efc
Author: Oleksii Shumeiko <oshumeik@cisco.com>
Date:   Tue May 10 14:48:58 2022 +0300

    http_inspect: check if input available before JavaScript normalization

src/service_inspectors/http_inspect/http_msg_body.cc

index 1515302578b8a9572a62b10ee538cd3d8996e837..3aa4b02691d3d93e8665046c8cfb4cb2ffaf0511 100644 (file)
@@ -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)