Uninitialised memory read in z80-dis.c

Message ID 20200324223216.GZ4583@bubble.grove.modra.org
State New
Headers show
Series
  • Uninitialised memory read in z80-dis.c
Related show

Commit Message

Stefan Schulze Frielinghaus via Binutils March 24, 2020, 10:32 p.m.
objdump -d -m ez80-adl testcase:
 .byte 0x40,0xfd

	* z80-dis.c (suffix): Init mybuf.


-- 
Alan Modra
Australia Development Lab, IBM

Patch

diff --git a/opcodes/z80-dis.c b/opcodes/z80-dis.c
index b23e8e99fd..cd84044451 100644
--- a/opcodes/z80-dis.c
+++ b/opcodes/z80-dis.c
@@ -804,6 +804,7 @@  suffix (struct buffer *buf, disassemble_info *info, const char *txt)
   old_stream = info->stream;
   info->fprintf_func = (fprintf_ftype) &sprintf;
   info->stream = mybuf;
+  mybuf[0] = 0;
   buf->base++;
   if (print_insn_z80_buf (buf, info) >= 0)
     buf->n_used++;