Skip to content

FTL v5.3.1 fails to build with gcc 10.2.x #950

@ganto

Description

@ganto

Platform

  • OS and version: Gentoo

I'm aware that Gentoo is not a supported platform but due to the nature of the bug it might be reproducible on other platforms supporting gcc-10.2.x too. I tried to reproduce it on Fedora 32 which unfortunately failed because of a missing libidn-static (libidn.a)

Expected behavior

FTL build completes successful.

Actual behavior / bug

$ gcc --version
gcc (Gentoo 10.2.0-r3 p4) 10.2.0
Copyright (C) 2020 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.

Error due to potential string truncation:

$ ./build.sh
[...]
Building Pi-hole FTL daemon                                    
   - Branch: master                                            
   - Architecture: x86_64 (compiled locally)
   - Version: v5.3.1
   - Tag: v5.3.1
   - Hash: e1db31d
   - Commit date: 2020-11-28 21:59:12 +0100
[...]
[ 50%] Building C object src/dnsmasq/CMakeFiles/dnsmasq.dir/inotify.c.o                                                                                        
[ 50%] Building C object src/dnsmasq/CMakeFiles/dnsmasq.dir/ipset.c.o          
In file included from /usr/include/string.h:519,                              
                 from /usr/include/sys/un.h:37,                                                                                                                
                 from /home/ganto/FTL/src/dnsmasq/dnsmasq.h:105,           
                 from /home/ganto/FTL/src/dnsmasq_interface.c:12:
In function 'strncpy',
    inlined from '_FTL_new_query' at /home/ganto/FTL/src/dnsmasq_interface.c:558:3:
/usr/include/bits/string_fortified.h:106:10: error: '__builtin_strncpy' output may be truncated copying 45 bytes from a string of length 45 [-Werror=stringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[...]

Steps to reproduce

If you want to reproduce it on Gentoo you can use the feature/pi-hole branch from my linuxmonk-overlay.

Otherwise I would expect any other Linux distribution that meets the requirements and a recent enough gcc version to fail with the same error.

Additional context

This is not a bug that affects the end users but sooner or later you might step over it too. Note that the same code compiles fine when using gcc-9.3.0 on Gentoo. Also FTL v5.2 compiled fine with gcc-10.2.0.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions