From 391efe37ed0241f6c623d0015f4cd9081f144125 Mon Sep 17 00:00:00 2001 From: Simen Svale Skogsrud Date: Mon, 6 Jun 2011 08:38:38 +0200 Subject: [PATCH] avoid line buffer overflow --- protocol.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/protocol.c b/protocol.c index b6ea2ba..1275f8d 100644 --- a/protocol.c +++ b/protocol.c @@ -78,7 +78,10 @@ void protocol_process() line[char_counter] = 0; // treminate string status_message(protocol_execute_line(line)); char_counter = 0; // reset line buffer index - } else if (c <= ' ') { // Throw away whitepace and control characters + } else if (c <= ' ') { + // Throw away whitepace and control characters + } else if (char_counter >= LINE_BUFFER_SIZE-1) { + // Throw away any characters beyond the end of the line buffer } else if (c >= 'a' && c <= 'z') { // Upcase lowercase line[char_counter++] = c-'a'+'A'; } else {