Skip to content

fix GCC strncpy warnings - #112

Merged
haad merged 1 commit into
haad:masterfrom
sorki:fixWarnings
Mar 26, 2022
Merged

fix GCC strncpy warnings#112
haad merged 1 commit into
haad:masterfrom
sorki:fixWarnings

Conversation

@sorki

@sorki sorki commented Feb 17, 2021

Copy link
Copy Markdown
Contributor

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

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
```
@sorki

sorki commented Feb 17, 2021

Copy link
Copy Markdown
Contributor Author

Related to NixOS/nixpkgs#112929

@haad
haad merged commit 0ef3d6d into haad:master Mar 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants