From 0348dcd25198d2ddb3dcab6f5cb1bddc9307e0d5 Mon Sep 17 00:00:00 2001 From: Giorgio Vazzana Date: Mon, 2 Jun 2014 17:44:11 +0200 Subject: [PATCH] bug fix, #286 buffer overflow in src/frontend/plotting/grid.c --- src/frontend/plotting/grid.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/frontend/plotting/grid.c b/src/frontend/plotting/grid.c index f2d1d6602..41a5ddc6d 100644 --- a/src/frontend/plotting/grid.c +++ b/src/frontend/plotting/grid.c @@ -16,7 +16,7 @@ Modified: 2001 AlansFixes #include "../display.h" #define RAD_TO_DEG (180.0 / M_PI) -#define LABEL_CHARS 20 +#define LABEL_CHARS 16 typedef enum { x_axis, y_axis } Axis; @@ -365,9 +365,9 @@ lingrid(GRAPH *graph, double lo, double hi, double delta, int type, Axis axis) } if ((s = ft_typabbrev(type)) != NULL) - (void) strncat(buf, s, sizeof(buf) - 1); + (void) strncat(buf, s, sizeof(buf) - strlen(buf) - 1); else - (void) strncat(buf, "Units", sizeof(buf) - 1); + (void) strncat(buf, "Units", sizeof(buf) - strlen(buf) - 1); if (delta == 0.0) { int i;