Fix another strncpy warning
authorAlan Modra <amodra@gmail.com>
Fri, 18 Jun 2021 12:55:10 +0000 (22:25 +0930)
committerAlan Modra <amodra@gmail.com>
Sat, 19 Jun 2021 01:38:55 +0000 (11:08 +0930)
* tic30-dis.c (get_register_operand): Don't ask strncpy to fill
entire buffer.

opcodes/ChangeLog
opcodes/tic30-dis.c

index 8f4b97683435d57ce134c18c3d6824cd9ad24e33..f262529d566a06a48c5eb6173ddfb15ec1e4b510 100644 (file)
@@ -1,3 +1,8 @@
+2021-06-19  Alan Modra  <amodra@gmail.com>
+
+       * tic30-dis.c (get_register_operand): Don't ask strncpy to fill
+       entire buffer.
+
 2021-06-17  Alan Modra  <amodra@gmail.com>
 
        * ppc-opc.c (powerpc_opcodes): Move cell db*cyc to proper location
index bb96c07e712af3227d11840564b7bdf36ff082f6..a78a0dad218c61d269b9cb9a57c49b1460f9f080 100644 (file)
@@ -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;
        }