ploot

plot images or real-time plain text from a .csv file
Log | Files | Refs | README

commit 1a593aa504c78dbc507ed118a004cff811620065
parent 8321d90e92e7e25c50844e48f758be3b72f98a68
Author: Josuah Demangeon <mail@josuah.net>
Date:   Mon,  7 May 2018 10:25:38 +0200

sprintf() -> snprintf()

Diffstat:
Mplootxt.c | 8+++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/plootxt.c b/plootxt.c @@ -190,11 +190,13 @@ read_labels(char *labv[LINE_MAX]) static void fmt_labels(char out[LINE_MAX], int ncol, char *labels[LINE_MAX / 2]) { - int i; + int i, n; printf("%d\n", width); - for (i = 0; i < ncol; labels++, i++) - out += sprintf(out, "│%-*s", width - 1, *labels); + for (i = 0; i < ncol; labels++, i++) { + n = LINE_MAX - (width + sizeof("│")) * i; + out += snprintf(out, n, "│%-*s", width - 1, *labels); + } } static void