From 9e4ecb638fab2710f79f4c30e3adf16a9598cc75 Mon Sep 17 00:00:00 2001 From: gitlost Date: Sun, 21 Nov 2021 15:49:32 +0000 Subject: [PATCH] CODE128/EAN14: fix debug printf bar spaces (not NUL-terminated) --- backend/code128.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/code128.c b/backend/code128.c index 71346329..169b7a67 100644 --- a/backend/code128.c +++ b/backend/code128.c @@ -712,7 +712,7 @@ INTERNAL int code128(struct zint_symbol *symbol, unsigned char source[], int len printf(" %d", values[i]); } printf(" (%d)\n", bar_characters); - printf("Barspaces: %s\n", dest); + printf("Barspaces: %.*s\n", (int) (d - dest), dest); } #ifdef ZINT_TEST if (symbol->debug & ZINT_DEBUG_TEST) { @@ -951,7 +951,7 @@ INTERNAL int gs1_128_cc(struct zint_symbol *symbol, unsigned char source[], int printf(" %d", values[i]); } printf(" (%d)\n", bar_characters); - printf("Barspaces: %s\n", dest); + printf("Barspaces: %.*s\n", (int) (d - dest), dest); } #ifdef ZINT_TEST if (symbol->debug & ZINT_DEBUG_TEST) {