Re: [cim PATCH] Ensure nul termination of hostname

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1/31/19 2:13 PM, Daniel P. Berrangé wrote:
> Newest GCC warns that the string copying is potentially truncated and
> thus not nul terminated.
> 
> In file included from /usr/include/string.h:494,
>                  from ../../src/Virt_HostSystem.c:23:
> In function ‘strncpy’,
>     inlined from ‘resolve_host’ at ../../src/Virt_HostSystem.c:55:28,
>     inlined from ‘get_fqdn’ at ../../src/Virt_HostSystem.c:92:23,
>     inlined from ‘set_host_system_properties’ at ../../src/Virt_HostSystem.c:109:13:
> /usr/include/bits/string_fortified.h:106:10: error: ‘__builtin_strncpy’ specified bound 256 equals destination size [-Werror=stringop-truncation]
>   106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
>       |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> In function ‘strncpy’,
>     inlined from ‘resolve_host’ at ../../src/Virt_HostSystem.c:67:17,
>     inlined from ‘get_fqdn’ at ../../src/Virt_HostSystem.c:92:23,
>     inlined from ‘set_host_system_properties’ at ../../src/Virt_HostSystem.c:109:13:
> /usr/include/bits/string_fortified.h:106:10: error: ‘__builtin_strncpy’ specified bound 256 equals destination size [-Werror=stringop-truncation]
>   106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
>       |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors
> 
> Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
> ---
>  src/Virt_HostSystem.c | 30 +++++++++++++++---------------
>  1 file changed, 15 insertions(+), 15 deletions(-)

ACK

Michal

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux