From: Jeff Lucovsky Date: Mon, 29 Jun 2020 13:54:15 +0000 (-0400) Subject: output/fileinfo: Optimize filename output X-Git-Tag: suricata-6.0.0-beta1~296 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4127c5fcc8d6e8522cb3432a1d0bf2d2959cab1e;p=thirdparty%2Fsuricata.git output/fileinfo: Optimize filename output This commit optimizes the JSON preparation of the file name by eliminating the temporary copy before adding to the Json builder buffer. --- diff --git a/src/output-json.c b/src/output-json.c index c159d3509d..3d3eeb173b 100644 --- a/src/output-json.c +++ b/src/output-json.c @@ -137,10 +137,7 @@ static int64_t sensor_id = -1; /* -1 = not defined */ void EveFileInfo(JsonBuilder *jb, const File *ff, const bool stored) { - size_t filename_size = ff->name_len * 2 + 1; - char filename_string[filename_size]; - BytesToStringBuffer(ff->name, ff->name_len, filename_string, filename_size); - jb_set_string(jb, "filename", filename_string); + jb_set_string_from_bytes(jb, "filename", ff->name, ff->name_len); jb_open_array(jb, "sid"); for (uint32_t i = 0; ff->sid != NULL && i < ff->sid_cnt; i++) {