]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
htp/lzma: set limit from configuration 4201/head
authorJason Ish <jason.ish@oisf.net>
Thu, 12 Sep 2019 20:53:07 +0000 (14:53 -0600)
committerVictor Julien <victor@inliniac.net>
Sat, 14 Sep 2019 08:27:49 +0000 (10:27 +0200)
Also use a default defined in Suricata, not libhtp.

src/app-layer-htp.c
src/app-layer-htp.h
suricata.yaml.in

index b2ebf9d0a5551984df1d1d92abf8b886793e3e55..141c69afe3de3283f508e30919f03e03681a61f0 100644 (file)
@@ -2330,7 +2330,10 @@ static void HTPConfigSetDefaultsPhase1(HTPCfgRec *cfg_prec)
 
     /* don't convert + to space by default */
     htp_config_set_plusspace_decode(cfg_prec->cfg, HTP_DECODER_URLENCODED, 0);
-
+#ifdef HAVE_HTP_CONFIG_SET_LZMA_MEMLIMIT
+    htp_config_set_lzma_memlimit(cfg_prec->cfg,
+            HTP_CONFIG_DEFAULT_LZMA_MEMLIMIT);
+#endif
     /* libhtp <= 0.5.9 doesn't use soft limit, but it's impossible to set
      * only the hard limit. So we set both here to the (current) htp defaults.
      * The reason we do this is that if the user sets the hard limit in the
@@ -2651,8 +2654,8 @@ static void HTPConfigParseParameters(HTPCfgRec *cfg_prec, ConfNode *s,
                            "from conf file cannot be 0.");
             }
             /* set default soft-limit with our new hard limit */
-            htp_config_set_lzma_memlimit(cfg_prec->cfg,
-                    (size_t)limit);
+            SCLogConfig("Setting HTTP LZMA memory limit to %"PRIu32" bytes", limit);
+            htp_config_set_lzma_memlimit(cfg_prec->cfg, (size_t)limit);
 #endif
         } else if (strcasecmp("randomize-inspection-sizes", p->name) == 0) {
             if (!g_disable_randomness) {
index 59a741aa36697650ba9914bec5df47c345160515..45fe4017bd4e39807e2107502ce80a1642755719 100644 (file)
@@ -51,6 +51,9 @@
 #define HTP_CONFIG_DEFAULT_FIELD_LIMIT_SOFT             9000U
 #define HTP_CONFIG_DEFAULT_FIELD_LIMIT_HARD             18000U
 
+/* default libhtp lzma limit, taken from libhtp. */
+#define HTP_CONFIG_DEFAULT_LZMA_MEMLIMIT                1048576U
+
 #define HTP_CONFIG_DEFAULT_RANDOMIZE                    1
 #define HTP_CONFIG_DEFAULT_RANDOMIZE_RANGE              10
 
index bbcf006bbe1f3a5fcc86f56b9f669a5549db491b..31cfcc73091817b621aea67072af397ce7f9f36b 100644 (file)
@@ -963,6 +963,9 @@ app-layer:
            double-decode-path: no
            double-decode-query: no
 
+           # LZMA decompression memory limit.
+           #lzma-memlimit: 1 Mb
+
          server-config:
 
            #- apache: