From acd2fa45d20e4445140fbad3dae7032019dff16b Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Tue, 7 Feb 2012 18:16:02 +0100 Subject: [PATCH] write_graphite plugin: Fix trailing underscores. This may also fix an off-by-one error when the name is long enough. D'oh! Change-Id: Ibc5a68f9bc93eed6366d074b55a7aca020bcf990 --- src/write_graphite.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/write_graphite.c b/src/write_graphite.c index cc4e38a3..fca40d1a 100644 --- a/src/write_graphite.c +++ b/src/write_graphite.c @@ -364,15 +364,18 @@ static void wg_copy_escape_part (char *dst, const char *src, size_t dst_len, for (i = 0; i < dst_len; i++) { + if (src[i] == 0) + { + dst[i] = 0; + break; + } + if ((src[i] == '.') || isspace ((int) src[i]) || iscntrl ((int) src[i])) dst[i] = escape_char; else dst[i] = src[i]; - - if (src[i] == 0) - break; } } -- 2.30.2