Re: fwts_hwinfo.c:503:3: error: ‘strncpy’ output may be truncated copying 255 bytes from a string of length 255 [-Werror=stringop-truncation]
Colin Ian King
colin.king at canonical.com
Fri Aug 17 18:13:27 UTC 2018
Fix sent to fwts-devel mailing list for review:
https://lists.ubuntu.com/archives/fwts-devel/2018-August/010874.html
Hopefully we will get that into the next fwts release next week.
Colin
On 17/08/18 16:33, Paul Menzel wrote:
> [Please CC me on replies, as I am not subscribed.]
>
> Dear FWTS folks,
>
>
> Trying to build FWTS under Debian Sid/unstable fails with the error below.
>
> ```
> $ gcc --version | head -1
> gcc (Debian 8.2.0-4) 8.2.0
> $ git describe --dirty
> V18.07.00-64-g266634aa
> $ make -j4
> make all-recursive
> make[1]: Entering directory '/home/paul/src/fwts'
> Making all in src
> make[2]: Entering directory '/home/paul/src/fwts/src'
> Making all in acpica/source/compiler
> make[3]: Entering directory '/home/paul/src/fwts/src/acpica/source/compiler'
> make all-am
> make[4]: Entering directory '/home/paul/src/fwts/src/acpica/source/compiler'
> make[4]: Nothing to be done for 'all-am'.
> make[4]: Leaving directory '/home/paul/src/fwts/src/acpica/source/compiler'
> make[3]: Leaving directory '/home/paul/src/fwts/src/acpica/source/compiler'
> Making all in lib
> make[3]: Entering directory '/home/paul/src/fwts/src/lib'
> Making all in src
> make[4]: Entering directory '/home/paul/src/fwts/src/lib/src'
> /bin/bash ../../../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I../../.. -I../../../src/lib/include -I../../../src/acpica/source/include -I../../../src/acpica/source/compile
> r `pkg-config --silence-errors --cflags json` `pkg-config --silence-errors --cflags json-c` `pkg-config --cflags glib-2.0 gio-2.0` -DDATAROOTDIR=\"/usr/local/share\" -Wall -Werror -Wextra -D
> ACPI_DEBUG_OUTPUT -g -O2 -MT libfwts_la-fwts_framework.lo -MD -MP -MF .deps/libfwts_la-fwts_framework.Tpo -c -o libfwts_la-fwts_framework.lo `test -f 'fwts_framework.c' || echo './'`fwts_f
> ramework.c
> /bin/bash ../../../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I../../.. -I../../../src/lib/include -I../../../src/acpica/source/include -I../../../src/acpica/source/compile
> r `pkg-config --silence-errors --cflags json` `pkg-config --silence-errors --cflags json-c` `pkg-config --cflags glib-2.0 gio-2.0` -DDATAROOTDIR=\"/usr/local/share\" -Wall -Werror -Wextra -D
> ACPI_DEBUG_OUTPUT -g -O2 -MT libfwts_la-fwts_gpe.lo -MD -MP -MF .deps/libfwts_la-fwts_gpe.Tpo -c -o libfwts_la-fwts_gpe.lo `test -f 'fwts_gpe.c' || echo './'`fwts_gpe.c
> /bin/bash ../../../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I../../.. -I../../../src/lib/include -I../../../src/acpica/source/include -I../../../src/acpica/source/compile
> r `pkg-config --silence-errors --cflags json` `pkg-config --silence-errors --cflags json-c` `pkg-config --cflags glib-2.0 gio-2.0` -DDATAROOTDIR=\"/usr/local/share\" -Wall -Werror -Wextra -D
> ACPI_DEBUG_OUTPUT -g -O2 -MT libfwts_la-fwts_guid.lo -MD -MP -MF .deps/libfwts_la-fwts_guid.Tpo -c -o libfwts_la-fwts_guid.lo `test -f 'fwts_guid.c' || echo './'`fwts_guid.c
> /bin/bash ../../../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I../../.. -I../../../src/lib/include -I../../../src/acpica/source/include -I../../../src/acpica/source/compile
> r `pkg-config --silence-errors --cflags json` `pkg-config --silence-errors --cflags json-c` `pkg-config --cflags glib-2.0 gio-2.0` -DDATAROOTDIR=\"/usr/local/share\" -Wall -Werror -Wextra -D
> ACPI_DEBUG_OUTPUT -g -O2 -MT libfwts_la-fwts_hwinfo.lo -MD -MP -MF .deps/libfwts_la-fwts_hwinfo.Tpo -c -o libfwts_la-fwts_hwinfo.lo `test -f 'fwts_hwinfo.c' || echo './'`fwts_hwinfo.c
> libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../.. -I../../../src/lib/include -I../../../src/acpica/source/include -I../../../src/acpica/source/compiler -I/usr/include/json-c -pthread -I/
> usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -DDATAROOTDIR=\"/usr/local/share\" -Wall -Werror -Wextra -DACPI_DEBUG_OUTPUT -g -O2 -MT libfwts_la-fwts_hwinfo.lo -MD -MP -M
> F .deps/libfwts_la-fwts_hwinfo.Tpo -c fwts_hwinfo.c -fPIC -DPIC -o .libs/libfwts_la-fwts_hwinfo.o
> libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../.. -I../../../src/lib/include -I../../../src/acpica/source/include -I../../../src/acpica/source/compiler -I/usr/include/json-c -pthread -I/
> usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -DDATAROOTDIR=\"/usr/local/share\" -Wall -Werror -Wextra -DACPI_DEBUG_OUTPUT -g -O2 -MT libfwts_la-fwts_gpe.lo -MD -MP -MF .
> deps/libfwts_la-fwts_gpe.Tpo -c fwts_gpe.c -fPIC -DPIC -o .libs/libfwts_la-fwts_gpe.o
> libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../.. -I../../../src/lib/include -I../../../src/acpica/source/include -I../../../src/acpica/source/compiler -I/usr/include/json-c -pthread -I/
> usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -DDATAROOTDIR=\"/usr/local/share\" -Wall -Werror -Wextra -DACPI_DEBUG_OUTPUT -g -O2 -MT libfwts_la-fwts_framework.lo -MD -MP
> -MF .deps/libfwts_la-fwts_framework.Tpo -c fwts_framework.c -fPIC -DPIC -o .libs/libfwts_la-fwts_framework.o
> libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../.. -I../../../src/lib/include -I../../../src/acpica/source/include -I../../../src/acpica/source/compiler -I/usr/include/json-c -pthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -DDATAROOTDIR=\"/usr/local/share\" -Wall -Werror -Wextra -DACPI_DEBUG_OUTPUT -g -O2 -MT libfwts_la-fwts_guid.lo -MD -MP -MF .deps/libfwts_la-fwts_guid.Tpo -c fwts_guid.c -fPIC -DPIC -o .libs/libfwts_la-fwts_guid.o
> libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../.. -I../../../src/lib/include -I../../../src/acpica/source/include -I../../../src/acpica/source/compiler -I/usr/include/json-c -pthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -DDATAROOTDIR=\"/usr/local/share\" -Wall -Werror -Wextra -DACPI_DEBUG_OUTPUT -g -O2 -MT libfwts_la-fwts_guid.lo -MD -MP -MF .deps/libfwts_la-fwts_guid.Tpo -c fwts_guid.c -o libfwts_la-fwts_guid.o >/dev/null 2>&1
> fwts_hwinfo.c: In function ‘fwts_hwinfo_pci_get’:
> fwts_hwinfo.c:503:3: error: ‘strncpy’ output may be truncated copying 255 bytes from a string of length 255 [-Werror=stringop-truncation]
> strncpy(pci_config->name, d->d_name, NAME_MAX);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../.. -I../../../src/lib/include -I../../../src/acpica/source/include -I../../../src/acpica/source/compiler -I/usr/include/json-c -pthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -DDATAROOTDIR=\"/usr/local/share\" -Wall -Werror -Wextra -DACPI_DEBUG_OUTPUT -g -O2 -MT libfwts_la-fwts_gpe.lo -MD -MP -MF .deps/libfwts_la-fwts_gpe.Tpo -c fwts_gpe.c -o libfwts_la-fwts_gpe.o >/dev/null 2>&1
> mv -f .deps/libfwts_la-fwts_guid.Tpo .deps/libfwts_la-fwts_guid.Plo
> /bin/bash ../../../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I../../.. -I../../../src/lib/include -I../../../src/acpica/source/include -I../../../src/acpica/source/compiler `pkg-config --silence-errors --cflags json` `pkg-config --silence-errors --cflags json-c` `pkg-config --cflags glib-2.0 gio-2.0` -DDATAROOTDIR=\"/usr/local/share\" -Wall -Werror -Wextra -DACPI_DEBUG_OUTPUT -g -O2 -MT libfwts_la-fwts_iasl.lo -MD -MP -MF .deps/libfwts_la-fwts_iasl.Tpo -c -o libfwts_la-fwts_iasl.lo `test -f 'fwts_iasl.c' || echo './'`fwts_iasl.c
> In function ‘fwts_hwinfo_net_get’,
> inlined from ‘fwts_hwinfo_get’ at fwts_hwinfo.c:661:2:
> fwts_hwinfo.c:400:3: error: ‘strncpy’ output may be truncated copying 15 bytes from a string of length 255 [-Werror=stringop-truncation]
> strncpy(buf.ifr_name, d->d_name, sizeof(buf.ifr_name) - 1);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> fwts_hwinfo.c:413:3: error: ‘strncpy’ output may be truncated copying 15 bytes from a string of length 255 [-Werror=stringop-truncation]
> strncpy(buf.ifr_name, d->d_name, sizeof(buf.ifr_name) - 1);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors
> make[4]: *** [Makefile:939: libfwts_la-fwts_hwinfo.lo] Error 1
> make[4]: *** Waiting for unfinished jobs....
> libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../.. -I../../../src/lib/include -I../../../src/acpica/source/include -I../../../src/acpica/source/compiler -I/usr/include/json-c -pthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -DDATAROOTDIR=\"/usr/local/share\" -Wall -Werror -Wextra -DACPI_DEBUG_OUTPUT -g -O2 -MT libfwts_la-fwts_iasl.lo -MD -MP -MF .deps/libfwts_la-fwts_iasl.Tpo -c fwts_iasl.c -fPIC -DPIC -o .libs/libfwts_la-fwts_iasl.o
> mv -f .deps/libfwts_la-fwts_gpe.Tpo .deps/libfwts_la-fwts_gpe.Plo
> libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../.. -I../../../src/lib/include -I../../../src/acpica/source/include -I../../../src/acpica/source/compiler -I/usr/include/json-c -pthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -DDATAROOTDIR=\"/usr/local/share\" -Wall -Werror -Wextra -DACPI_DEBUG_OUTPUT -g -O2 -MT libfwts_la-fwts_iasl.lo -MD -MP -MF .deps/libfwts_la-fwts_iasl.Tpo -c fwts_iasl.c -o libfwts_la-fwts_iasl.o >/dev/null 2>&1
> mv -f .deps/libfwts_la-fwts_iasl.Tpo .deps/libfwts_la-fwts_iasl.Plo
> libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../.. -I../../../src/lib/include -I../../../src/acpica/source/include -I../../../src/acpica/source/compiler -I/usr/include/json-c -pthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -DDATAROOTDIR=\"/usr/local/share\" -Wall -Werror -Wextra -DACPI_DEBUG_OUTPUT -g -O2 -MT libfwts_la-fwts_framework.lo -MD -MP -MF .deps/libfwts_la-fwts_framework.Tpo -c fwts_framework.c -o libfwts_la-fwts_framework.o >/dev/null 2>&1
> mv -f .deps/libfwts_la-fwts_framework.Tpo .deps/libfwts_la-fwts_framework.Plo
> make[4]: Leaving directory '/home/paul/src/fwts/src/lib/src'
> make[3]: *** [Makefile:372: all-recursive] Error 1
> make[3]: Leaving directory '/home/paul/src/fwts/src/lib'
> make[2]: *** [Makefile:4600: all-recursive] Error 1
> make[2]: Leaving directory '/home/paul/src/fwts/src'
> make[1]: *** [Makefile:776: all-recursive] Error 1
> make[1]: Leaving directory '/home/paul/src/fwts'
> make: *** [Makefile:707: all] Error 2
> ```
>
>
> Kind regards,
>
> Paul
>
>
>
More information about the fwts-devel
mailing list