Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/haad/proxychains.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Marko <srk@48.io>2021-02-13 13:14:08 +0300
committerRichard Marko <srk@48.io>2021-02-13 13:14:08 +0300
commit412ef4235bda09285aad9d0d5097e66366b20c28 (patch)
tree5321be50db0a42a0a0ca3d7d3118bd7d62076640
parent148b851d10abb2dcb36cf2b952e9bca2561081d7 (diff)
fix GCC strncpy warnings
Recent GCC added checks for this and it triggers `Werror` with ``` In function 'strncpy', inlined from 'proxy_gethostbyname' at src/core.c:832:2: /nix/store/hayaj8q9rc7swx4llcjqymmg3zr525lx-glibc-2.32-25-dev/include/bits/string_fortified.h:91:10: error: '__builtin_strncpy' specified bound 8192 equals destination size [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wstringop-truncation-Werror=stringop-truncation8;;] 91 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In function 'strncpy', inlined from 'proxy_getaddrinfo' at src/core.c:917:3: /nix/store/hayaj8q9rc7swx4llcjqymmg3zr525lx-glibc-2.32-25-dev/include/bits/string_fortified.h:91:10: error: '__builtin_strncpy' specified bound 256 equals destination size [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wstringop-truncation-Werror=stringop-truncation8;;] 91 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors ```
-rw-r--r--src/core.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/core.c b/src/core.c
index d5f85f7..7e52f83 100644
--- a/src/core.c
+++ b/src/core.c
@@ -829,7 +829,7 @@ struct hostent *proxy_gethostbyname(const char *name, struct gethostbyname_data*
MUTEX_UNLOCK(&internal_ips_lock);
- strncpy(data->addr_name, name, sizeof(data->addr_name));
+ strncpy(data->addr_name, name, sizeof(data->addr_name) - 1);
data->hostent_space.h_name = data->addr_name;
data->hostent_space.h_length = sizeof(in_addr_t);
@@ -914,7 +914,7 @@ int proxy_getaddrinfo(const char *node, const char *service, const struct addrin
p->ai_addr = &space->sockaddr_space;
if(node)
- strncpy(space->addr_name, node, sizeof(space->addr_name));
+ strncpy(space->addr_name, node, sizeof(space->addr_name) - 1);
p->ai_canonname = space->addr_name;
p->ai_next = NULL;
p->ai_family = space->sockaddr_space.sa_family = AF_INET;