From e49891e188f618a0e98f1d30bcbf240286e8ad5c Mon Sep 17 00:00:00 2001 From: Sven-Haegar Koch Date: Wed, 31 Mar 2010 03:56:53 +0200 Subject: [PATCH] Fixed metadata protokoll corruption on forwarded requests When forwarding a metadata request through forward_request() we were adding the required newline char to our buffer, but then sending the data without it - this results in the forwarded request and the next one to be garbled together. Additionally while at it add a warning comment that request string is not zero terminated anymore after a call to the forward_request() function - for now this is ok as it is not used by any caller after this. --- src/protocol.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/protocol.c b/src/protocol.c index 90eca01..e866e31 100644 --- a/src/protocol.c +++ b/src/protocol.c @@ -103,6 +103,7 @@ bool send_request(connection_t *c, const char *format, ...) { } void forward_request(connection_t *from, char *request) { + /* Note: request is not zero terminated anymore after a call to this function! */ ifdebug(PROTOCOL) { ifdebug(META) logger(LOG_DEBUG, "Forwarding %s from %s (%s): %s", @@ -113,7 +114,7 @@ void forward_request(connection_t *from, char *request) { } int len = strlen(request); - request[len] = '\n'; + request[len++] = '\n'; broadcast_meta(from, request, len); } -- 2.25.1