From d984392e752c43ec226a9d0df23af0c743e2b411 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Fri, 18 Jun 2021 22:25:10 +0930 Subject: [PATCH] Fix another strncpy warning * tic30-dis.c (get_register_operand): Don't ask strncpy to fill entire buffer. --- opcodes/ChangeLog | 5 +++++ opcodes/tic30-dis.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 8f4b9768343..f262529d566 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,8 @@ +2021-06-19 Alan Modra + + * tic30-dis.c (get_register_operand): Don't ask strncpy to fill + entire buffer. + 2021-06-17 Alan Modra * ppc-opc.c (powerpc_opcodes): Move cell db*cyc to proper location diff --git a/opcodes/tic30-dis.c b/opcodes/tic30-dis.c index bb96c07e712..a78a0dad218 100644 --- a/opcodes/tic30-dis.c +++ b/opcodes/tic30-dis.c @@ -201,7 +201,7 @@ get_register_operand (unsigned char fragment, char *buffer) { if ((fragment & 0x1F) == current_reg->opcode) { - strncpy (buffer, current_reg->name, OPERAND_BUFFER_LEN); + strncpy (buffer, current_reg->name, OPERAND_BUFFER_LEN - 1); buffer[OPERAND_BUFFER_LEN - 1] = 0; return 1; } -- 2.30.2