From fa50a090f77856d22a9592c43f3bd875f67aa3b9 Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Sun, 27 Dec 2015 20:30:41 +0100 Subject: [PATCH] Avoid undefined memory access --- src/modems/hayes.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modems/hayes.c b/src/modems/hayes.c index d4888de..7ce0e27 100644 --- a/src/modems/hayes.c +++ b/src/modems/hayes.c @@ -1304,7 +1304,7 @@ static int _queue_push_do(Hayes * hayes, HayesChannel * channel) HayesCommand * command; char const * prefix = ""; char const * attention; - const char suffix[2] = "\r\n"; + const char suffix[] = "\r\n"; size_t size; char * p; guint timeout; @@ -1328,7 +1328,7 @@ static int _queue_push_do(Hayes * hayes, HayesChannel * channel) #ifdef DEBUG fprintf(stderr, "DEBUG: %s() pushing \"%s\"\n", __func__, attention); #endif - size = strlen(prefix) + strlen(attention) + sizeof(suffix); + size = strlen(prefix) + strlen(attention) + sizeof(suffix) - 1; if((p = realloc(channel->wr_buf, channel->wr_buf_cnt + size)) == NULL) { hayes_command_set_status(command, HCS_ERROR);