avoid illegal array indexes now that the enum treads beyond BL_FLUSH

This commit is contained in:
nhmall
2018-09-22 08:58:38 -04:00
parent 8e4ce066c9
commit 0a52543076

View File

@@ -930,7 +930,7 @@ unsigned long *colormasks UNUSED;
is buffered so final BL_FLUSH is needed to produce output) */
windowprocs.wincap2 |= WC2_FLUSH_STATUS;
if (idx != BL_FLUSH) {
if (idx >= 0) {
if (!status_activefields[idx])
return;
switch (idx) {
@@ -972,11 +972,15 @@ unsigned long *colormasks UNUSED;
break;
}
return; /* processed one field other than BL_FLUSH */
} /* (idx != BL_FLUSH) */
} /* (idx >= 0, thus not BL_FLUSH, BL_RESET, BL_CHARACTERISTICS) */
/* We've received BL_FLUSH; time to output the gathered data */
nb = newbot1;
*nb = '\0';
/* BL_FLUSH is the only pseudo-index value we need to check for
in the loop below because it is the only entry used to pad the
end of the fieldorder array. We could stop on any
negative (illegal) index, but this should be fine */
for (i = 0; (idx1 = fieldorder[0][i]) != BL_FLUSH; ++i) {
if (status_activefields[idx1])
Strcpy(nb = eos(nb), status_vals[idx1]);