]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
rdp: address comments in pull request
authorJason Ish <jason.ish@oisf.net>
Mon, 9 Sep 2019 17:32:28 +0000 (11:32 -0600)
committerVictor Julien <victor@inliniac.net>
Mon, 9 Sep 2019 20:00:29 +0000 (22:00 +0200)
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
src/output-json-rdp.c

index ac98deb2148405dae03c9369941d89f620964b5d..0226a31c8fe84ce262adc4070c970baa533b91d3 100644 (file)
@@ -53,7 +53,7 @@ fn desktop_scale_to_opt(x: u32) -> Option<u32> {
     }
 }
 
-/// 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<u32> {
     if x == 100 || x == 140 || x == 180 {
index 050009dd63d80040a0aa231e3128fb9e592af7b9..875033e18bdcc31128bc5a5f4c88ca9b22d2ec10 100644 (file)
@@ -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;