Re: [PATCH] util: avoid overflow in hextable buffer

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

 



On Mon, Jan 20, 2025 at 10:09:24AM +0000, Daniel P. Berrangé wrote:
> The assigned string is 17 chars long once the trailing nul is taken
> into account. This triggers a warning with GCC 15
> 
>  src/util/virsystemd.c: In function ‘virSystemdEscapeName’:
>  src/util/virsystemd.c:59:38: error: initializer-string for array of ‘char’ is too long [-Werror=unterminated-string-initialization]
>     59 |     static const char hextable[16] = "0123456789abcdef";
>        |                                      ^~~~~~~~~~~~~~~~~~
> 
> Switch to a dynamically sized array as used in all the other places
> we have a hextable array.
> 
> See also: https://gcc.gnu.org/PR115185
> Reported-by: Yaakov Selkowitz <yselkowi@xxxxxxxxxx>
> Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
> ---
>  src/util/virsystemd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Pavel Hrdina <phrdina@xxxxxxxxxx>

Attachment: signature.asc
Description: PGP signature


[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