Introduction
Introduction Statistics Contact Development Disclaimer Help
sprintf() -> snprintf() - ploot - simple plotting tools
git clone git://bitreich.org/ploot git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65…
Log
Files
Refs
Tags
README
LICENSE
---
commit 1a593aa504c78dbc507ed118a004cff811620065
parent 8321d90e92e7e25c50844e48f758be3b72f98a68
Author: Josuah Demangeon <[email protected]>
Date: Mon, 7 May 2018 10:25:38 +0200
sprintf() -> snprintf()
Diffstat:
M plootxt.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
You are viewing proxied material from bitreich.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.