aboutsummaryrefslogtreecommitdiff
path: root/opcodes
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-09-10 14:12:52 +0930
committerAlan Modra <amodra@gmail.com>2020-09-10 14:12:52 +0930
commit23bef3fea380f383f910fd48f9d4f5633ee0d366 (patch)
tree369801622d6b30dee7f094311f017f10b696e1e3 /opcodes
parenta3a08c5a2f1e278ab54ec7ca836e08df71d3a25d (diff)
downloadgdb-23bef3fea380f383f910fd48f9d4f5633ee0d366.zip
gdb-23bef3fea380f383f910fd48f9d4f5633ee0d366.tar.gz
gdb-23bef3fea380f383f910fd48f9d4f5633ee0d366.tar.bz2
sprintf arg overlaps destination
* csky-dis.c (csky_output_operand): Don't sprintf str to itself.
Diffstat (limited to 'opcodes')
-rw-r--r--opcodes/ChangeLog4
-rw-r--r--opcodes/csky-dis.c8
2 files changed, 8 insertions, 4 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index bd5a284..cbd62b7 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,7 @@
+2020-09-10 Alan Modra <amodra@gmail.com>
+
+ * csky-dis.c (csky_output_operand): Don't sprintf str to itself.
+
2020-09-07 Cooper Qu <cooper.qu@linux.alibaba.com>
* csky-opc.h (csky_v2_opcodes): Change mvtc and mulsw's
diff --git a/opcodes/csky-dis.c b/opcodes/csky-dis.c
index 89f1c6b..78ff055 100644
--- a/opcodes/csky-dis.c
+++ b/opcodes/csky-dis.c
@@ -647,8 +647,8 @@ csky_output_operand (char *str, struct operand const *oprnd,
float f = 0;
memcpy (&f, &value, sizeof (float));
- sprintf (str, "%s%f\t// imm9:%4d, imm4:%2d", str, f, imm8, imm4);
-
+ sprintf (buf, "%f\t// imm9:%4d, imm4:%2d", f, imm8, imm4);
+ strcat (str, buf);
break;
}
@@ -675,8 +675,8 @@ csky_output_operand (char *str, struct operand const *oprnd,
}
double d = 0;
memcpy (&d, &dvalue, sizeof (double));
- sprintf (str, "%s%lf\t// imm9:%4ld, imm4:%2ld", str, d, imm8, imm4);
-
+ sprintf (buf, "%lf\t// imm9:%4ld, imm4:%2ld", d, imm8, imm4);
+ strcat (str, buf);
break;
}
case OPRND_TYPE_LABEL_WITH_BRACKET: