From: Alan Modra Date: Fri, 18 Jun 2021 12:55:10 +0000 (+0930) Subject: Fix another strncpy warning X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d984392e752c43ec226a9d0df23af0c743e2b411;p=binutils-gdb.git Fix another strncpy warning * tic30-dis.c (get_register_operand): Don't ask strncpy to fill entire buffer. --- 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; }