From: Mark Wielaard Date: Sun, 12 Feb 2017 20:51:34 +0000 (+0100) Subject: libasm: Fix one GCC7 -Wformat-truncation=2 warning. X-Git-Tag: elfutils-0.169~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=93c51144c3f664d4e9709da75a1d0fa00ea0fe95;p=thirdparty%2Felfutils.git libasm: Fix one GCC7 -Wformat-truncation=2 warning. Make sure that if we have really lots of labels the tempsym doesn't get truncated because it is too small to hold the whole name. This doesn't enable -Wformat-truncation=2 or fix other "issues" pointed out by enabling this warning because there are currently some issues with it. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79448 Signed-off-by: Mark Wielaard --- diff --git a/libasm/ChangeLog b/libasm/ChangeLog index 26fc5a951..165684221 100644 --- a/libasm/ChangeLog +++ b/libasm/ChangeLog @@ -1,8 +1,12 @@ +2017-02-12 Mark Wielaard + + * asm_newsym.c (asm_newsym): Increase TEMPSYMLEN to 13. + 2017-02-15 Ulf Hermann * disasm_str.c: Include system.h. -2015-10-11 Akihiko Odaki +2016-10-11 Akihiko Odaki * asm_align.c: Remove sys/param.h include. diff --git a/libasm/asm_newsym.c b/libasm/asm_newsym.c index 332432a99..53891668a 100644 --- a/libasm/asm_newsym.c +++ b/libasm/asm_newsym.c @@ -1,5 +1,5 @@ /* Define new symbol for current position in given section. - Copyright (C) 2002, 2005, 2016 Red Hat, Inc. + Copyright (C) 2002, 2005, 2016, 2017 Red Hat, Inc. This file is part of elfutils. Written by Ulrich Drepper , 2002. @@ -44,7 +44,9 @@ AsmSym_t * asm_newsym (AsmScn_t *asmscn, const char *name, GElf_Xword size, int type, int binding) { -#define TEMPSYMLEN 10 +/* We don't really expect labels with many digits, but in theory it could + be 10 digits (plus ".L" and a zero terminator). */ +#define TEMPSYMLEN 13 char tempsym[TEMPSYMLEN]; AsmSym_t *result;