mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-22 11:00:01 +08:00
opcodes/arm: don't pass non-string literal to printf like function
The earlier commit: commit 6576bffe6cbbb53c5756b2fccd2593ba69b74cdf Date: Thu Jul 7 13:43:45 2022 +0100 opcodes/arm: add disassembler styling for arm introduced two places where a register name was passed as the format string to the disassembler's fprintf_styled_func callback. This will cause a warning from some compilers, like this: ../../binutils-gdb/opcodes/arm-dis.c: In function ‘print_mve_vld_str_addr’: ../../binutils-gdb/opcodes/arm-dis.c:6005:3: error: format not a string literal and no format arguments [-Werror=format-security] 6005 | func (stream, dis_style_register, arm_regnames[gpr]); | ^~~~ This commit fixes these by using "%s" as the format string.
This commit is contained in:
@ -6002,7 +6002,7 @@ print_mve_vld_str_addr (struct disassemble_info *info,
|
|||||||
add_sub = "-";
|
add_sub = "-";
|
||||||
|
|
||||||
func (stream, dis_style_text, "[");
|
func (stream, dis_style_text, "[");
|
||||||
func (stream, dis_style_register, arm_regnames[gpr]);
|
func (stream, dis_style_register, "%s", arm_regnames[gpr]);
|
||||||
if (p == 1)
|
if (p == 1)
|
||||||
{
|
{
|
||||||
func (stream, dis_style_text, ", ");
|
func (stream, dis_style_text, ", ");
|
||||||
@ -8588,7 +8588,8 @@ print_insn_coprocessor_1 (const struct sopcode32 *opcodes,
|
|||||||
is_unpredictable = true;
|
is_unpredictable = true;
|
||||||
u_reg = value;
|
u_reg = value;
|
||||||
}
|
}
|
||||||
func (stream, dis_style_register, arm_regnames[value]);
|
func (stream, dis_style_register, "%s",
|
||||||
|
arm_regnames[value]);
|
||||||
break;
|
break;
|
||||||
case 'V':
|
case 'V':
|
||||||
if (given & (1 << 6))
|
if (given & (1 << 6))
|
||||||
|
Reference in New Issue
Block a user