From 601fb8cb34918de91be457dedb16cceeeb754338 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Mon, 26 May 2014 22:47:58 +1000 Subject: [PATCH] Fix off-by-one error --- src/generator.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/generator.c b/src/generator.c index 7264a956..cf5197eb 100644 --- a/src/generator.c +++ b/src/generator.c @@ -269,12 +269,13 @@ static bool send_json_msg(connsock_t *cs, json_t *json_msg) s = json_dumps(json_msg, JSON_ESCAPE_SLASH); LOGDEBUG("Sending json msg: %s", s); - len = strlen(s) + 1; + len = strlen(s); sent = write_socket(cs->fd, s, len); + len += 1; dealloc(s); sent += write_socket(cs->fd, "\n", 1); if (sent != len) { - LOGWARNING("Failed to send %d bytes in send_json_msg", len); + LOGWARNING("Failed to send %d bytes sent %d in send_json_msg", len, sent); return false; } return true;