]> git.ipfire.org Git - thirdparty/elfutils.git/commit
backends: allocate enough stace for null terminator
authorSergei Trofimovich <slyich@gmail.com>
Wed, 17 Jul 2024 22:03:34 +0000 (23:03 +0100)
committerMark Wielaard <mark@klomp.org>
Thu, 18 Jul 2024 16:43:33 +0000 (18:43 +0200)
commit7508696d107ca01b65ce8273c881462a8658f90f
tree0bcd4798706abce1a71b7174eb8ef2355fc9e961
parent87a60d22299c4ba7b94cbce04a32c2abf015f98a
backends: allocate enough stace for null terminator

`gcc-15` added a new warning in https://gcc.gnu.org/PR115185:

    i386_regs.c:88:11: error: initializer-string for array of 'char' is too long [-Werror=unterminated-string-initialization]
       88 |           "ax", "cx", "dx", "bx", "sp", "bp", "si", "di", "ip"
          |           ^~~~

`elfutils` does not need to store '\0'. We could either initialize the
arrays with individual bytes or allocate extra byte for null.

This change initializes the array bytewise.

* backends/i386_regs.c (i386_register_info): Initialize the
array bytewise to fix gcc-15 warning.
* backends/x86_64_regs.c (x86_64_register_info): Ditto.

Signed-off-by: Sergei Trofimovich <slyich@gmail.com>
backends/i386_regs.c
backends/x86_64_regs.c