From 3a262e873c50491889f21661dde046ce5f1b33de Mon Sep 17 00:00:00 2001 From: cwu Date: Mon, 11 Feb 2013 07:52:15 -0800 Subject: [PATCH 1/3] fix CID# 11341 --- clamdtop/clamdtop.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clamdtop/clamdtop.c b/clamdtop/clamdtop.c index 786e1fcfb..efbc110b2 100644 --- a/clamdtop/clamdtop.c +++ b/clamdtop/clamdtop.c @@ -520,6 +520,7 @@ static int make_connection_real(const char *soname, conn_t *conn) memset(&addr, 0, sizeof(addr)); addr.sun_family = AF_UNIX; strncpy(addr.sun_path, soname, sizeof(addr.sun_path)); + addr.sun_path[sizeof(addr.sun_path)-1]=0x0; print_con_info(conn, "Connecting to: %s\n", soname); if (connect(s, (struct sockaddr *)&addr, sizeof(addr))) { perror("connect"); @@ -1004,7 +1005,7 @@ static void parse_stats(conn_t *conn, struct stats *stats, unsigned idx) stats->conn_min = (conn_dt/60)%60; stats->conn_sec = conn_dt%60; stats->current_q = 0; - + buf[sizeof(buf) - 1] = 0x0; while(recv_line(conn, buf, sizeof(buf)) && strcmp("END\n",buf) != 0) { char *val = strchr(buf, ':'); From e1c57cd9c139bf0711ba885666175c71b1cfb5c9 Mon Sep 17 00:00:00 2001 From: cwu Date: Mon, 11 Feb 2013 08:20:35 -0800 Subject: [PATCH 2/3] fix CID# 11304 --- clamdtop/clamdtop.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/clamdtop/clamdtop.c b/clamdtop/clamdtop.c index efbc110b2..6a78ac872 100644 --- a/clamdtop/clamdtop.c +++ b/clamdtop/clamdtop.c @@ -360,13 +360,14 @@ static void header(void) static void show_bar(WINDOW *win, size_t i, unsigned live, unsigned idle, unsigned max, int blink) { - int y,x; + int y,x,z; unsigned len = 39; unsigned start = 1; unsigned activ = max ? ((live-idle)*(len - start - 2) + (max/2)) / max : 0; unsigned dim = max ? idle*(len - start - 2) / max : 0; unsigned rem = len - activ - dim - start-2; - + + z=0; assert(activ + 2 < len && activ+dim + 2 < len && activ+dim+rem + 2 < len && "Invalid values"); mvwaddch(win, i, start, '[' | A_BOLD); wattron(win, A_BOLD | COLOR_PAIR(activ_color)); @@ -382,7 +383,10 @@ static void show_bar(WINDOW *win, size_t i, unsigned live, unsigned idle, waddch(win, ']' | A_BOLD); if(blink) { getyx(win, y, x); - mvwaddch(win, y, x-2, '>' | A_BLINK | COLOR_PAIR(red_color)); + if (x >= 2) { + z = x - 2; + } + mvwaddch(win, y, z, '>' | A_BLINK | COLOR_PAIR(red_color)); move(y, x); } } From f26b33aa0db4d82360e1591f2ca1ef78aa00d96f Mon Sep 17 00:00:00 2001 From: cwu Date: Mon, 11 Feb 2013 08:37:58 -0800 Subject: [PATCH 3/3] fix CID# 11299 --- clamdtop/clamdtop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clamdtop/clamdtop.c b/clamdtop/clamdtop.c index 6a78ac872..4b6ad7795 100644 --- a/clamdtop/clamdtop.c +++ b/clamdtop/clamdtop.c @@ -524,7 +524,7 @@ static int make_connection_real(const char *soname, conn_t *conn) memset(&addr, 0, sizeof(addr)); addr.sun_family = AF_UNIX; strncpy(addr.sun_path, soname, sizeof(addr.sun_path)); - addr.sun_path[sizeof(addr.sun_path)-1]=0x0; + addr.sun_path[sizeof(addr.sun_path) - 1] = 0x0; print_con_info(conn, "Connecting to: %s\n", soname); if (connect(s, (struct sockaddr *)&addr, sizeof(addr))) { perror("connect");