From ef1066346672b1a83a4d2146e61659984a3b97fd Mon Sep 17 00:00:00 2001 From: Andre Date: Thu, 2 Mar 2006 15:08:38 +0100 Subject: [PATCH] fix off-by-one error Also, make "bufsize" const instead of static. --- gui_common.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gui_common.c b/gui_common.c index 2c499126..d806ebe2 100644 --- a/gui_common.c +++ b/gui_common.c @@ -13,8 +13,9 @@ int para_open_audiod_pipe(char *cmd) int read_audiod_pipe(int fd, void (*line_handler)(char *) ) { - static char buf[STRINGSIZE + 1]; - static ssize_t loaded, bufsize = sizeof(buf); + static char buf[STRINGSIZE]; + const ssize_t bufsize = sizeof(buf) - 1; + static ssize_t loaded; ssize_t ret; if (loaded >= bufsize) -- 2.39.2