summaryrefslogtreecommitdiff
path: root/opcodes
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2021-06-18 22:25:10 +0930
committerAlan Modra <amodra@gmail.com>2021-06-19 11:08:55 +0930
commitd984392e752c43ec226a9d0df23af0c743e2b411 (patch)
tree1fbdbc1c64377ff815586161aa572b3f22d8c41a /opcodes
parent539b54f03dd082c572308246e610e516ff96b5b1 (diff)
downloadbinutils-gdb-d984392e752c43ec226a9d0df23af0c743e2b411.tar.gz
Fix another strncpy warning
* tic30-dis.c (get_register_operand): Don't ask strncpy to fill entire buffer.
Diffstat (limited to 'opcodes')
-rw-r--r--opcodes/ChangeLog5
-rw-r--r--opcodes/tic30-dis.c2
2 files changed, 6 insertions, 1 deletions
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 <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
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;
}