From: Alan Modra Date: Fri, 24 Mar 2023 06:00:48 +0000 (+1030) Subject: Tidy string_ptr increment X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9c26a640c760f8b51a810f72e7dc58dd1d467cf4;p=binutils-gdb.git Tidy string_ptr increment * peicode.h (pe_ILF_make_a_symbol): Use sprintf output to increment string_ptr to end of new string. --- diff --git a/bfd/peicode.h b/bfd/peicode.h index f1f3ce81533..f16aeca7a1b 100644 --- a/bfd/peicode.h +++ b/bfd/peicode.h @@ -576,7 +576,7 @@ pe_ILF_make_a_symbol (pe_ILF_vars * vars, esym = vars->esym_ptr; /* Copy the symbol's name into the string table. */ - sprintf (vars->string_ptr, "%s%s", prefix, symbol_name); + int len = sprintf (vars->string_ptr, "%s%s", prefix, symbol_name); if (section == NULL) section = bfd_und_section_ptr; @@ -612,7 +612,7 @@ pe_ILF_make_a_symbol (pe_ILF_vars * vars, vars->table_ptr ++; vars->native_ptr ++; vars->esym_ptr ++; - vars->string_ptr += strlen (symbol_name) + strlen (prefix) + 1; + vars->string_ptr += len + 1; BFD_ASSERT (vars->string_ptr < vars->end_string_ptr); }