From: Gerald Pfeifer Subject: winedump: Increase buffer size and potential string length inoutput_spec_symbol. Message-Id: Date: Sat, 21 Jan 2017 17:26:42 +0100 (CET) This is another case where GCC 7 is going to warn: output.c: In function ¡output_spec_symbol¢: output.c:71:28: warning: ¡%d¢ directive output may be truncated writing between 1 and 11 bytes into a region of size 8 [-Wformat-truncation=] snprintf(ord_spec, 8, "%d", sym->ordinal); ^~ output.c:71:27: note: using the range [1, -2147483648] for directive argument snprintf(ord_spec, 8, "%d", sym->ordinal); ^~~~ output.c:71:5: note: format output between 2 and 12 bytes into a destination of size 8 snprintf(ord_spec, 8, "%d", sym->ordinal); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Addressed easy enough by increasing the size of the buffer and the length parameter to snprintf as per the patch below. By the way, why is parsed_symbol.ordinal a signed integer, and not unsigned? (And related, "%d" and not "%u"?) Gerald Signed-off-by: Gerald Pfeifer --- tools/winedump/output.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/winedump/output.c b/tools/winedump/output.c index 6c2bfae5b3..bbbb1ac039 100644 --- a/tools/winedump/output.c +++ b/tools/winedump/output.c @@ -62,13 +62,13 @@ void output_spec_preamble (void) */ void output_spec_symbol (const parsed_symbol *sym) { - char ord_spec[16]; + char ord_spec[20]; assert (specfile); assert (sym && sym->symbol); if (sym->ordinal >= 0) - snprintf(ord_spec, 8, "%d", sym->ordinal); + snprintf(ord_spec, 12, "%d", sym->ordinal); else { ord_spec[0] = '@'; -- 2.11.0