Bug#905029: xtrs: FTBFS with gcc-8
Control: tags -1 + patch Control: forwarded -1 https://github.com/TimothyPMann/xtrs/pull/25 The attached patch fixes the warning and allows building it successfully. Kind regards, Reiner From e76e83104e4dc8d71c9ab3adcfd9aa512dbc7fd0 Mon Sep 17 00:00:00 2001 From: Reiner Herrmann Date: Mon, 6 Aug 2018 19:38:50 +0200 Subject: [PATCH] Use snprintf for string padding Recent gcc versions emit new warnings about string truncation: cmddump.c:78:7: error: 'strncat' output truncated copying between 0 and 8 bytes from a string of length 8 [-Werror=stringop-truncation] strncat(pdsbuf, "", 8 - strlen(pdsbuf)); ^~~ This can be prevented by using snprintf for string padding. Bug-Debian: https://bugs.debian.org/905029 --- cmddump.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cmddump.c b/cmddump.c index 174e72a..1b07bd8 100644 --- a/cmddump.c +++ b/cmddump.c @@ -76,9 +76,7 @@ main(int argc, char* argv[]) isam = strtol(optarg, NULL, 0); break; case 'p': - strncpy(pdsbuf, optarg, 8); - pdsbuf[8] = '\000'; - strncat(pdsbuf, "", 8 - strlen(pdsbuf)); + snprintf(pdsbuf, sizeof(pdsbuf), "%s%8s", optarg, ""); pds = pdsbuf; break; case 'x': -- 2.18.0 signature.asc Description: PGP signature
Bug#905029: xtrs: FTBFS with gcc-8
Source: xtrs Version: 4.9c-4 Severity: serious Tags: sid buster Justification: fails to build from source (but built successfully in the past) Hi, xtrs FTBFS since gcc-8 became the default gcc, probably due to usage of -Werror and new warnings being emitted by the new compiler version: cc -Wall -Werror -Wno-error=unused-but-set-variable -O2 -g -D_REENTRANT -DDEFAULT_ROM='"/usr/local/lib/xtrs/level2rom.hex"' -DDEFAULT_ROM3='"/usr/local/lib/xtrs/romimage.m3"' -DDEFAULT_ROM4P='"/usr/local/lib/xtrs/romimage.m4p"' -DREADLINE -DDISKDIR='"."' -I/usr/include/X11 -DAPPDEFAULTS='"/usr/X11/lib/X11/app-defaults"' -DKBWAIT -c -o cmddump.o cmddump.c cmddump.c: In function 'main': cmddump.c:78:7: error: 'strncat' output truncated copying between 0 and 8 bytes from a string of length 8 [-Werror=stringop-truncation] strncat(pdsbuf, "", 8 - strlen(pdsbuf)); ^~~ cc1: all warnings being treated as errors make[1]: *** [: cmddump.o] Error 1 make[1]: Leaving directory '/build/xtrs-4.9c' make: *** [debian/rules:36: build-stamp] Error 2 dpkg-buildpackage: error: debian/rules build subprocess returned exit status 2 Andreas xtrs_4.9c-4.log.gz Description: application/gzip