aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2020-05-28 11:04:27 +0100
committerNick Clifton <nickc@redhat.com>2020-05-28 11:04:27 +0100
commit151f5de4a6548cd83a79b4705f1e901776ddacc5 (patch)
treed7c8f412774cc13cd558062cd7e32bf6e7e55e8e
parent72a3b182e1352a2e83d8fb781b848dba9c4be6c5 (diff)
downloadgdb-151f5de4a6548cd83a79b4705f1e901776ddacc5.zip
gdb-151f5de4a6548cd83a79b4705f1e901776ddacc5.tar.gz
gdb-151f5de4a6548cd83a79b4705f1e901776ddacc5.tar.bz2
Fix a potential use of an uninitialised value in the ns32k disassembler.
* ns32k-dis.c (print_insn_ns32k): Change the arg_bufs array to static.
-rw-r--r--opcodes/ChangeLog5
-rw-r--r--opcodes/ns32k-dis.c5
2 files changed, 9 insertions, 1 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 52cbe8e..0189209 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,8 @@
+2020-05-28 Nick Clifton <nickc@redhat.com>
+
+ * ns32k-dis.c (print_insn_ns32k): Change the arg_bufs array to
+ static.
+
2020-05-26 Sandra Loosemore <sandra@codesourcery.com>
Fix extraction of signed constants in nios2 disassembler (again).
diff --git a/opcodes/ns32k-dis.c b/opcodes/ns32k-dis.c
index 12df182..ccad820 100644
--- a/opcodes/ns32k-dis.c
+++ b/opcodes/ns32k-dis.c
@@ -738,7 +738,10 @@ print_insn_ns32k (bfd_vma memaddr, disassemble_info *info)
unsigned short first_word;
int ioffset; /* Bits into instruction. */
int aoffset; /* Bits into arguments. */
- char arg_bufs[MAX_ARGS+1][ARG_LEN];
+ /* The arg_bufs array is made static in order to avoid a potential
+ use of an uninitialised value if we are asekd to disassemble a
+ corrupt instruction. */
+ static char arg_bufs[MAX_ARGS+1][ARG_LEN];
int argnum;
int maxarg;
struct private priv;