From 3f777ce5e2437e38a168d7ce65e106d0b8b64ebc Mon Sep 17 00:00:00 2001 From: Blair Bonnett Date: Mon, 17 Sep 2012 15:10:23 +1200 Subject: [PATCH] Fix msg_check_escapes() so it allows escaped backslashes. If a valid escape (\n, \s, or \\) is found, increment the pointer marking the start of the next search so we don't start looking at the escaped character. The old behaviour was a problem for messages containing slashes -- the escaped slash would be looked at in the next pass and so the following character would be treated as an escape, causing the message to be dropped for having "an invalid ADC escape". --- src/adc/message.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/adc/message.c b/src/adc/message.c index eb14630..52b2d33 100644 --- a/src/adc/message.c +++ b/src/adc/message.c @@ -76,6 +76,12 @@ static int msg_check_escapes(const char* string, size_t len) case '\\': case 'n': case 's': + /* Increment so we don't check the escaped + * character next time around. Not doing so + * leads to messages with escaped backslashes + * being incorrectly reported as having invalid + * escapes. */ + ++start; break; default: return 0;