Fix another strncpy warning

Message ID YM1HJEaQ7vq2GsKx@squeak.grove.modra.org
State New
Headers show
Series
  • Fix another strncpy warning
Related show

Commit Message

Andrea Corallo via Binutils June 19, 2021, 1:23 a.m.
* tic30-dis.c (get_register_operand): Don't ask strncpy to fill
	entire buffer.


-- 
Alan Modra
Australia Development Lab, IBM

Patch

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;
 	}