HI all, There is a tiny patch proposal for the log component.
Cheers.
From f1924d813f37cd6444d9251605fdd823efb7fe20 Mon Sep 17 00:00:00 2001 From: David Carlier <devne...@gmail.com> Date: Thu, 18 Feb 2016 21:46:48 +0000 Subject: [PATCH] CLEANUP: log The string to be escaped is not marked at const, and it would be safer to copy instead of casting. --- src/log.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/log.c b/src/log.c index 3e25bc7..94864e1 100644 --- a/src/log.c +++ b/src/log.c @@ -831,13 +831,19 @@ char *lf_text_len(char *dst, const char *src, size_t len, size_t size, struct lo if (src && len) { if (node->options & LOG_OPT_ESC) { struct chunk chunk; - char *ret; + char *ret, *ssrc; - chunk_initlen(&chunk, (char *)src, 0, len); + ssrc = my_strndup(src, len); + if (ssrc == NULL) + return NULL; + chunk_initlen(&chunk, ssrc, 0, len); ret = escape_chunk(dst, dst + size, '\\', rfc5424_escape_map, &chunk); - if (ret == NULL || *ret != '\0') + if (ret == NULL || *ret != '\0') { + chunk_destroy(&chunk); return NULL; + } len = ret - dst; + chunk_destroy(&chunk); } else { if (++len > size) -- 2.7.0