From: Mark Wielaard Date: Tue, 16 Jun 2020 15:53:08 +0000 (+0200) Subject: backends: Make the reloc_nametable zero element an one char array. X-Git-Tag: elfutils-0.181~30 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0d70fc0cb868ef95b25137d62bdaefa4a1462330;p=thirdparty%2Felfutils.git backends: Make the reloc_nametable zero element an one char array. We are using the reloc_nametable zero element as an char array. So make that element an actual array (we are actually after one of the next string arrays in the table). Signed-off-by: Mark Wielaard --- diff --git a/backends/ChangeLog b/backends/ChangeLog index 7d3578b03..c85dfd2ae 100644 --- a/backends/ChangeLog +++ b/backends/ChangeLog @@ -1,3 +1,9 @@ +2020-06-16 Mark Wielard + + * common-reloc.c (reloc_nametable): Make zero a 1 char array. + Initialize it as an array { '\0' }. + (reloc_type_name): Access zero as an array. + 2020-06-10 Mark Wielard * aarch64_init.c (aarch64_init): Remove ehlen, return eh. diff --git a/backends/common-reloc.c b/backends/common-reloc.c index 096ed1c73..a91bc87d3 100644 --- a/backends/common-reloc.c +++ b/backends/common-reloc.c @@ -45,14 +45,14 @@ static const struct EBLHOOK(reloc_nametable) { - char zero; + char zero[1]; #define RELOC_TYPE(type, uses) \ char name_##type[sizeof R_NAME (type)]; #include RELOC_TYPES #undef RELOC_TYPE } EBLHOOK(reloc_nametable) = { - '\0', + { '\0' }, #define RELOC_TYPE(type, uses) R_NAME (type), #include RELOC_TYPES #undef RELOC_TYPE @@ -92,7 +92,7 @@ EBLHOOK(reloc_type_name) (int reloc, #endif if (reloc >= 0 && reloc < nreloc && EBLHOOK(reloc_nameidx)[reloc] != 0) - return &reloc_namestr[EBLHOOK(reloc_nameidx)[reloc]]; + return reloc_namestr[EBLHOOK(reloc_nameidx)[reloc]]; return NULL; }