]> git.ipfire.org Git - people/ms/suricata.git/commitdiff
json: skip over double dots in output tokenizing
authorSascha Steinbiss <satta@debian.org>
Fri, 1 Sep 2017 14:24:56 +0000 (16:24 +0200)
committerVictor Julien <victor@inliniac.net>
Tue, 17 Oct 2017 09:08:26 +0000 (11:08 +0200)
Interface name shortening introduces double periods ('..') as spacers,
which cause issues during JSON stats serialization as there '.'
characters are also used as separators to define nesting of the JSON
output. This commit makes sure that '..' are skipped during tokenizing.
Fixes Redmine bug #2208.

src/output-json-stats.c

index 436d621ac44e7bc6f6bc9b83caba294ac7c705e8..0b99948b367da3b4a4f89533deb809e06a2478dc 100644 (file)
@@ -68,6 +68,8 @@ static json_t *OutputStats2Json(json_t *js, const char *key)
     const char *dot = index(key, '.');
     if (dot == NULL)
         return NULL;
+    if (*(dot + 1) == '.' && *(dot + 2) != '\0')
+        dot = index(dot + 2, '.');
 
     size_t predot_len = (dot - key) + 1;
     char s[predot_len];