# HG changeset patch # User John "Elwin" Edwards # Date 1486735378 18000 # Node ID e940e6c00751c9022fdbfdbeb9c3d62a5479c132 # Parent 3d4252fa2ed3aeaed2812f8725f639ada4fab09f 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. diff -r 3d4252fa2ed3 -r e940e6c00751 arogue5/options.c --- a/arogue5/options.c Sat Jan 28 15:49:41 2017 -0500 +++ b/arogue5/options.c Fri Feb 10 09:02:58 2017 -0500 @@ -377,6 +377,7 @@ * 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 @@ *(bool *)op->o_opt = FALSE; break; } + } /* * skip to start of next option name diff -r 3d4252fa2ed3 -r e940e6c00751 arogue7/options.c --- a/arogue7/options.c Sat Jan 28 15:49:41 2017 -0500 +++ b/arogue7/options.c Fri Feb 10 09:02:58 2017 -0500 @@ -350,6 +350,7 @@ * 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 @@ *(bool *)op->o_opt = FALSE; break; } + } /* * skip to start of next option name diff -r 3d4252fa2ed3 -r e940e6c00751 xrogue/options.c --- a/xrogue/options.c Sat Jan 28 15:49:41 2017 -0500 +++ b/xrogue/options.c Fri Feb 10 09:02:58 2017 -0500 @@ -374,6 +374,7 @@ * 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 @@ *(bool *)op->o_opt = FALSE; break; } + } /* * skip to start of next option name