From: Alan Modra Date: Thu, 16 Dec 2021 21:37:30 +0000 (+1030) Subject: try_build_id_prefix gcc-10 -Wformat-security errors X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=dbc6a0e2e4bdc70133d9165fb2e15b592bc27c53;p=binutils-gdb.git try_build_id_prefix gcc-10 -Wformat-security errors dwarf.c:11300:3: error: format not a string literal and no format arguments [-Werror=format-security] 11300 | f += sprintf (f, prefix); PR 28697 * dwarf.c (try_build_id_prefix): Avoid -Wformat-security error. --- diff --git a/binutils/dwarf.c b/binutils/dwarf.c index 12c5b0a8fa2..82ea3c62739 100644 --- a/binutils/dwarf.c +++ b/binutils/dwarf.c @@ -11297,12 +11297,11 @@ try_build_id_prefix (const char * prefix, char * filename, const unsigned char * { char * f = filename; - f += sprintf (f, prefix); - f += sprintf (f, ".build-id/%02x/", (unsigned) *data++); + f += sprintf (f, "%s.build-id/%02x/", prefix, (unsigned) *data++); id_len --; while (id_len --) f += sprintf (f, "%02x", (unsigned) *data++); - f += sprintf (f, ".debug"); + strcpy (f, ".debug"); return open_debug_file (filename); }