Subj : GCC 8.3 compiler warnings on CentOS 8
To   : All
From : James Digriz
Date : Wed Sep 02 2020 05:59 pm

Anyone else tried compiling on 8? Goes to completion but I'm getting piles of
warnings about string truncation and such. Eg:

.
.
.

log.c: In function ‘dolastlog’:
log.c:89:2: warning: ‘strncpy’ specified bound 32 equals destination size
[-Wstringop-truncation]
 strncpy(newlog.ll_line, line, sizeof newlog.ll_line);
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gcc -O2 -fno-strict-aliasing -Wall -Wshadow -Wwrite-strings
-Wstrict-prototypes
-D_REENTRANT -I/usr/local/include   -c setugid.c
gcc -O2 -fno-strict-aliasing -Wall -Wshadow -Wwrite-strings
-Wstrict-prototypes
-D_REENTRANT -I/usr/local/include   -c mblogin.c
In file included from mblogin.c:32:
mblogin.c: In function ‘main’:
mblogin.c:541:44: warning: ‘%s’ directive output may be truncated writing
up to 8191 bytes into a region of size 507 [-Wformat-truncation=]
     snprintf(fromhost, sizeof fromhost, _(" on `%s' from `%s'"), tty, cp);
                                           ^~~~~~~~~~~~~~~~~~~~
.
.
.

Presumably this might be something to be concerned about, but I haven't tried
running the resulting code yet, and won't run it as a production system until
somebody with more current gcc knowledge than mine weighs in.

Appreciate any input,
jbdigriz


   Greetings, James Digriz
   email: [email protected]

--- MBSE BBS v1.0.7.18 (GNU/Linux-x86_64)
* Origin: DragonsWeb Labs BBS 1:123/755 (1:123/755)