]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
script/dnp3-gen: update generator to reflect in tree changes
authorJason Ish <jason.ish@oisf.net>
Fri, 10 Jul 2020 19:19:35 +0000 (13:19 -0600)
committerShivani Bhardwaj <shivanib134@gmail.com>
Thu, 3 Dec 2020 22:39:55 +0000 (04:09 +0530)
Some changes were made to the generated files instead of the
generator script. Update the script to generate what is
in the current state of the in-tree generated files.

(cherry picked from commit 4976afd96abf7b8dd49b444ee81df8091668f75e)

scripts/dnp3-gen/dnp3-gen.py

index 3f1b124dc68f47c1819bf7905b75149fe5dd34cf..7aa434a0e35ff6f2c68c6a82ac8e39020fd33f3c 100755 (executable)
@@ -157,6 +157,7 @@ output_json_dnp3_objects_template = """/* Copyright (C) 2015 Open Information Se
 #include "app-layer-dnp3.h"
 #include "app-layer-dnp3-objects.h"
 #include "output-json-dnp3-objects.h"
+#include "output-json.h"
 
 void OutputJsonDNP3SetItem(json_t *js, DNP3Object *object,
     DNP3Point *point)
@@ -181,7 +182,7 @@ void OutputJsonDNP3SetItem(json_t *js, DNP3Object *object,
             json_object_set_new(js, "data->{{field.name}}",
                 json_string((char *){{field.name}}_b64));
 {% elif field.type == "vstr4" %}
-            json_object_set_new(js, "data->{{field.name}}", json_string(data->{{field.name}}));
+            json_object_set_new(js, "data->{{field.name}}", SCJsonString(data->{{field.name}}));
 {% elif field.type == "chararray" %}
             if (data->{{field.len_field}} > 0) {
                 /* First create a null terminated string as not all versions
@@ -189,7 +190,7 @@ void OutputJsonDNP3SetItem(json_t *js, DNP3Object *object,
                 char tmpbuf[data->{{field.len_field}} + 1];
                 memcpy(tmpbuf, data->{{field.name}}, data->{{field.len_field}});
                 tmpbuf[data->{{field.len_field}}] = '\\0';
-                json_object_set_new(js, "{{field.name}}", json_string(tmpbuf));
+                json_object_set_new(js, "{{field.name}}", SCJsonString(tmpbuf));
             } else {
                 json_object_set_new(js, "{{field.name}}", json_string(""));
             }