From 0f102989902f6b45fd942f2b74ab832fea132c90 Mon Sep 17 00:00:00 2001 From: Jason Ish Date: Mon, 9 Sep 2019 11:32:28 -0600 Subject: [PATCH] rdp: address comments in pull request Pull request: https://github.com/OISF/suricata/pull/4174 - fix commit: range -> set - OUTPUT_BUFFER_SIZE -> JSON_OUTPUT_BUFFER_SIZE - output: check for initdata first --- rust/src/rdp/parser.rs | 2 +- src/output-json-rdp.c | 13 +++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/rust/src/rdp/parser.rs b/rust/src/rdp/parser.rs index ac98deb214..0226a31c8f 100644 --- a/rust/src/rdp/parser.rs +++ b/rust/src/rdp/parser.rs @@ -53,7 +53,7 @@ fn desktop_scale_to_opt(x: u32) -> Option { } } -/// constrains device scale to a range, per spec +/// constrains device scale to a set of valid values, per spec /// rdp-spec, section 2.2.1.3.2 Client Core Data fn device_scale_to_opt(x: u32) -> Option { if x == 100 || x == 140 || x == 180 { diff --git a/src/output-json-rdp.c b/src/output-json-rdp.c index 050009dd63..875033e18b 100644 --- a/src/output-json-rdp.c +++ b/src/output-json-rdp.c @@ -117,22 +117,19 @@ static OutputInitResult OutputRdpLogInitSub(ConfNode *conf, return result; } -#define OUTPUT_BUFFER_SIZE 65535 - static TmEcode JsonRdpLogThreadInit(ThreadVars *t, const void *initdata, void **data) { - LogRdpLogThread *thread = SCCalloc(1, sizeof(*thread)); - if (unlikely(thread == NULL)) { + if (initdata == NULL) { + SCLogDebug("Error getting context for EveLogRdp. \"initdata\" is NULL."); return TM_ECODE_FAILED; } - if (initdata == NULL) { - SCLogDebug("Error getting context for EveLogRdp. \"initdata\" is NULL."); - SCFree(thread); + LogRdpLogThread *thread = SCCalloc(1, sizeof(*thread)); + if (unlikely(thread == NULL)) { return TM_ECODE_FAILED; } - thread->buffer = MemBufferCreateNew(OUTPUT_BUFFER_SIZE); + thread->buffer = MemBufferCreateNew(JSON_OUTPUT_BUFFER_SIZE); if (unlikely(thread->buffer == NULL)) { SCFree(thread); return TM_ECODE_FAILED;