From 7eeb9ddcb6bee33b92bea1e89f306ad4697eae74 Mon Sep 17 00:00:00 2001 From: "John \"Elwin\" Edwards" Date: Fri, 10 Feb 2017 09:02:58 -0500 Subject: [PATCH] Add some braces to a loop in parse_opts(). A for loop had no braces around its body, which was a single if-else statement. In Advanced Rogue 5, another statement had been added, accidentally removing the if-else from the loop. This could have resulted in an out-of-bounds access to the options array. In the other games, the added braces are only for clarity. --- arogue5/options.c | 2 ++ arogue7/options.c | 2 ++ xrogue/options.c | 2 ++ 3 files changed, 6 insertions(+) diff --git a/arogue5/options.c b/arogue5/options.c index 4a08ee0..9dacdc2 100644 --- a/arogue5/options.c +++ b/arogue5/options.c @@ -377,6 +377,7 @@ parse_opts(char *str) * Look it up and deal with it */ for (op = optlist; op <= &optlist[NUM_OPTS-1]; op++) + { /* None of these can be changed if using system savefiles. */ if (use_savedir && (!strcmp(op->o_name, "name") || !strcmp(op->o_name, "file") || @@ -442,6 +443,7 @@ parse_opts(char *str) *(bool *)op->o_opt = FALSE; break; } + } /* * skip to start of next option name diff --git a/arogue7/options.c b/arogue7/options.c index 5ae0bcf..c13529a 100644 --- a/arogue7/options.c +++ b/arogue7/options.c @@ -350,6 +350,7 @@ parse_opts(char *str) * Look it up and deal with it */ for (op = optlist; op <= &optlist[NUM_OPTS-1]; op++) + { if (EQSTR(str, op->o_name, len)) { if (op->o_putfunc == put_bool) /* if option is a boolean */ @@ -412,6 +413,7 @@ parse_opts(char *str) *(bool *)op->o_opt = FALSE; break; } + } /* * skip to start of next option name diff --git a/xrogue/options.c b/xrogue/options.c index 1e743e5..81be5f2 100644 --- a/xrogue/options.c +++ b/xrogue/options.c @@ -374,6 +374,7 @@ parse_opts(char *str) * Look it up and deal with it */ for (op = optlist; op < &optlist[NUM_OPTS]; op++) + { if (EQSTR(str, op->o_name, len)) { if (op->o_putfunc == put_bool) /* if option is a boolean */ @@ -435,6 +436,7 @@ parse_opts(char *str) *(bool *)op->o_opt = FALSE; break; } + } /* * skip to start of next option name