proxychains icon indicating copy to clipboard operation
proxychains copied to clipboard

Compiling with -Wall causes stringop-truncation error

Open viking opened this issue 2 years ago • 2 comments

After running ./configure and make, here's what happened:

cc -MD -Wall -O2 -g -std=c99 -D_GNU_SOURCE -pipe -DTHREAD_SAFE -Werror   -DLIB_DIR=\"/usr/local/lib\" -DINSTALL_PREFIX=\"/usr/local\" -DDLL_NAME=\"libproxychains4.so\" -DSYSCONFDIR=\"/usr/local/etc\"  -fPIC -c -o src/core.o src/core.c
src/core.c: In function ‘proxy_gethostbyname’:
src/core.c:832:9: error: ‘strncpy’ specified bound 8192 equals destination size [-Werror=stringop-truncation]
  832 |         strncpy(data->addr_name, name, sizeof(data->addr_name));
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/core.c: In function ‘proxy_getaddrinfo’:
src/core.c:917:17: error: ‘strncpy’ specified bound 256 equals destination size [-Werror=stringop-truncation]
  917 |                 strncpy(space->addr_name, node, sizeof(space->addr_name));
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make: *** [Makefile:65: src/core.o] Error 1

Here's my gcc version:

gcc (GCC) 11.1.1 20210531 (Red Hat 11.1.1-3)
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

viking avatar Jul 30 '21 19:07 viking