[binutils-gdb] Uninitialised memory read in z80-dis.c

Alan Modra amodra@sourceware.org
Tue Mar 24 22:27:32 GMT 2020


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a18cd0cab43f45b05e9f8bcbf8fed1d67834442d

commit a18cd0cab43f45b05e9f8bcbf8fed1d67834442d
Author: Alan Modra <amodra@gmail.com>
Date:   Wed Mar 25 08:50:21 2020 +1030

    Uninitialised memory read in z80-dis.c
    
    objdump -d -m ez80-adl testcase:
     .byte 0x40,0xfd
    
            * z80-dis.c (suffix): Init mybuf.

Diff:
---
 opcodes/ChangeLog | 4 ++++
 opcodes/z80-dis.c | 1 +
 2 files changed, 5 insertions(+)

diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 4c05e849daf..bdfccbac78c 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,7 @@
+2020-03-25  Alan Modra  <amodra@gmail.com>
+
+	* z80-dis.c (suffix): Init mybuf.
+
 2020-03-22  Alan Modra  <amodra@gmail.com>
 
 	* h8300-dis.c (bfd_h8_disassemble): Limit data[] access to that
diff --git a/opcodes/z80-dis.c b/opcodes/z80-dis.c
index b23e8e99fd8..cd840444511 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++;


More information about the Binutils-cvs mailing list