strncpy overflow warning in swiglal
@karl-wette every now and then I notice this warning cropping up when I build locally - mostly because the swiglal step takes a while and it's highlighted in a nice pink font. ;) Not sure for how long it has been around but quite some time; I guess it may cause failures on stricter setups at some point in the future, but isn't urgent to look into for now.
And of course the line numbers it gives for that auto-generated swiglal_python.c
monster file are not super helpful for tracking down the original source of the problem... But whenever you take a look at it and if you can't reproduce it, let me know if I should dig into it. This is on Debian 10 with gcc 8.3.0 and swig 3.0.12-2.
make[5]: Entering directory '/home/dkeitel/git/lvc/lalsuite/lal/swig'
CC swiglal_octave_la-SWIGTest.lo
GEN swiglal.i
GEN swiglal_octave.cpp
CXX swiglal_octave_la-swiglal_octave.lo
CXXLD swiglal_octave.la
CC swiglal_python_la-SWIGTest.lo
GEN swiglal_python.c
CC swiglal_python_la-swiglal_python.lo
swiglal_python.c: In function ‘SWIG_Python_addvarlink’:
swiglal_python.c:272939:9: warning: ‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
strncpy(gv->name,name,size);
^~~~~~~~~~~~~~~~~~~~~~~~~~~
swiglal_python.c:272936:21: note: length computed here
size_t size = strlen(name)+1;
^~~~~~~~~~~~
CCLD swiglal_python.la
swiglal_python.c: In function 'SWIG_Python_addvarlink':
swiglal_python.c:272932: warning: 'strncpy' specified bound depends on the length of the source argument [-Wstringop-overflow=]
SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) {
make[5]: Leaving directory '/home/dkeitel/git/lvc/lalsuite/lal/swig'