From: Eric Leblond Date: Mon, 19 Jun 2017 18:16:01 +0000 (+0200) Subject: util-print: add 0 at end of buffer X-Git-Tag: suricata-4.0.0-rc1~31 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=170591a0b156bcd4a8687e3e039ba6b7f7b54d6b;p=thirdparty%2Fsuricata.git util-print: add 0 at end of buffer Add a 0 at the end of the printed buffer to be sure we terminate with a 0 to avoid problem when calling strlen(). --- diff --git a/src/util-print.c b/src/util-print.c index 05ccafa777..544728b6fb 100644 --- a/src/util-print.c +++ b/src/util-print.c @@ -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; }