ve7fet/linuxax25

Warning ax25tools axgetput.c: In function ‘main’: axgetput.c:222:2: warning: ‘strncpy’

Opened this issue · 0 comments

f6bvp commented

When installing AX25apps with new Gcc

make[1] : on quitte le répertoire « /usr/local/src/ax25/linuxax25-master/ax25tools »
Compiling AX.25 tools
*
make all-recursive
make[1] : on entre dans le répertoire « /usr/local/src/ax25/linuxax25-master/ax25tools »
Making all in ax25
make[2] : on entre dans le répertoire « /usr/local/src/ax25/linuxax25-master/ax25tools/ax25 »
Making all in axgetput
make[3] : on entre dans le répertoire « /usr/local/src/ax25/linuxax25-master/ax25tools/ax25/axgetput »
gcc -DHAVE_CONFIG_H -I. -I../.. -D_GNU_SOURCE -g -O2 -MT axgetput.o -MD -MP -MF .deps/axgetput.Tpo -c -o axgetput.o axgetput.c
gcc -DHAVE_CONFIG_H -I. -I../.. -D_GNU_SOURCE -g -O2 -MT util.o -MD -MP -MF .deps/util.Tpo -c -o util.o util.c
gcc -DHAVE_CONFIG_H -I. -I../.. -D_GNU_SOURCE -g -O2 -MT proto_bin.o -MD -MP -MF .deps/proto_bin.Tpo -c -o proto_bin.o proto_bin.c
axgetput.c: In function ‘main’:
axgetput.c:222:2: warning: ‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
strncpy(myname, p, len);
^~~~~~~~~~~~~~~~~~~~~~~
axgetput.c:219:8: note: length computed here
len = strlen(p);
^~~~~~~~~

I suggest strncpy should be replaced by a fixed length copy according to array size declaration in #include file.

Bernard, f6bvp / ai7bg