/* -*- c -*- */
-/* Copyright (C) 2012-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2012-2017 Free Software Foundation, Inc.
Contributed by Red Hat.
Written by DJ Delorie.
#define W() rl78->size = RL78_Word
#define AU ATTRIBUTE_UNUSED
-#define GETBYTE() (ld->op [ld->rl78->n_bytes++] = ld->getbyte (ld->ptr))
+
+#define OP_BUF_LEN 20
+#define GETBYTE() (ld->rl78->n_bytes < (OP_BUF_LEN - 1) ? ld->op [ld->rl78->n_bytes++] = ld->getbyte (ld->ptr): 0)
#define B ((unsigned long) GETBYTE())
#define SYNTAX(x) rl78->syntax = x
RL78_Dis_Isa isa)
{
LocalData lds, * ld = &lds;
- unsigned char op_buf[20] = {0};
+ unsigned char op_buf[OP_BUF_LEN] = {0};
unsigned char *op = op_buf;
int op0, op1;
/** 1010 1110 movw %0, %s1 */
ID(mov); W(); DR(AX); SM(None, SFR);
-/** 11ra 1011 movw %0, %e!1 */
+/** 11ra 1011 movw %0, %es!1 */
ID(mov); W(); DRW(ra); SM(None, IMMU(2));
/** 11ra 1010 movw %0, %1 */