From: Victor Julien Date: Thu, 18 Jun 2015 10:04:44 +0000 (+0200) Subject: detect hsbd: simplify resize logic X-Git-Tag: suricata-3.0RC1~300 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=29fbcce50dc1cb1628398c3c60fb78adbb1607db;p=thirdparty%2Fsuricata.git detect hsbd: simplify resize logic --- diff --git a/src/detect-engine-hsbd.c b/src/detect-engine-hsbd.c index beba23966b..93440a198d 100644 --- a/src/detect-engine-hsbd.c +++ b/src/detect-engine-hsbd.c @@ -146,7 +146,6 @@ static void HSBDGetBufferForTXInIPSMode(DetectEngineThreadCtx *det_ctx, HtpTxUserData *htud, int index) { uint32_t window_size = 0; - int resize = 0; /* how much from before body_inspected will we consider? */ uint32_t cfg_win = @@ -163,10 +162,8 @@ static void HSBDGetBufferForTXInIPSMode(DetectEngineThreadCtx *det_ctx, SCLogDebug("weird: body size is %uk", window_size/1024); window_size = MAX_WINDOW; } - if (window_size > det_ctx->hsbd[index].buffer_size) - resize = 1; - if (det_ctx->hsbd[index].buffer == NULL || resize) { + if (det_ctx->hsbd[index].buffer == NULL || window_size > det_ctx->hsbd[index].buffer_size) { void *ptmp; if ((ptmp = HTPRealloc(det_ctx->hsbd[index].buffer, det_ctx->hsbd[index].buffer_size, window_size)) == NULL) { @@ -178,7 +175,6 @@ static void HSBDGetBufferForTXInIPSMode(DetectEngineThreadCtx *det_ctx, } det_ctx->hsbd[index].buffer = ptmp; det_ctx->hsbd[index].buffer_size = window_size; - resize = 0; } uint32_t left_edge = htud->response_body.body_inspected - cfg_win;