]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
util-print: add 0 at end of buffer
authorEric Leblond <eric@regit.org>
Mon, 19 Jun 2017 18:16:01 +0000 (20:16 +0200)
committerVictor Julien <victor@inliniac.net>
Mon, 26 Jun 2017 07:52:48 +0000 (09:52 +0200)
Add a 0 at the end of the printed buffer to be sure we terminate
with a 0 to avoid problem when calling strlen().

src/util-print.c

index 05ccafa777f2de2e55bb7d4a5d585d3ae5c0ad10..544728b6fb8e53616f70943546adad26de3b60ed 100644 (file)
@@ -227,6 +227,7 @@ void PrintStringsToBuffer(uint8_t *dst_buf, uint32_t *dst_buf_offset_ptr, uint32
                         src_buf[ch] == '\n' ||
                         src_buf[ch] == '\r') ? (uint8_t)src_buf[ch] : '.');
     }
+    dst_buf[dst_buf_size - 1] = 0;
 
     return;
 }