bug fix, #286 buffer overflow in src/frontend/plotting/grid.c

This commit is contained in:
Giorgio Vazzana 2014-06-02 17:44:11 +02:00 committed by rlar
parent 22b2349893
commit 0348dcd251
1 changed files with 3 additions and 3 deletions

View File

@ -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;