aboutsummaryrefslogtreecommitdiff
path: root/sim/arm/armos.c
diff options
context:
space:
mode:
Diffstat (limited to 'sim/arm/armos.c')
-rw-r--r--sim/arm/armos.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sim/arm/armos.c b/sim/arm/armos.c
index c49036f..ea3d229 100644
--- a/sim/arm/armos.c
+++ b/sim/arm/armos.c
@@ -260,7 +260,10 @@ SWIopen (ARMul_State * state, ARMword name, ARMword SWIflags)
return;
/* Now we need to decode the Demon open mode. */
- flags = translate_open_mode[SWIflags];
+ if (SWIflags >= sizeof (translate_open_mode) / sizeof (translate_open_mode[0]))
+ flags = 0;
+ else
+ flags = translate_open_mode[SWIflags];
/* Filename ":tt" is special: it denotes stdin/out. */
if (strcmp (buf, ":tt") == 0)