top: Harden calibrate_fields().
- Make sure i is at least 1 before "i - 1" and "--i". - Initialize endpflg (to 0, as it was originally, since it is static) before the "for" loop (the "break" may leave endpflg uninitialized, for example).
This commit is contained in:
parent
c424a64331
commit
6b8b102cf2
@ -2179,7 +2179,7 @@ static void calibrate_fields (void) {
|
|||||||
s = scat(s, fmtmk("%*.*s", len, len, h), w->columnhdr, sizeof(w->columnhdr));
|
s = scat(s, fmtmk("%*.*s", len, len, h), w->columnhdr, sizeof(w->columnhdr));
|
||||||
}
|
}
|
||||||
#ifndef USE_X_COLHDR
|
#ifndef USE_X_COLHDR
|
||||||
if (EU_XON == w->procflgs[i - 1]) --i;
|
if (i >= 1 && EU_XON == w->procflgs[i - 1]) --i;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* establish the final maxpflgs and prepare to grow the variable column
|
/* establish the final maxpflgs and prepare to grow the variable column
|
||||||
@ -2193,6 +2193,7 @@ static void calibrate_fields (void) {
|
|||||||
fit within screen width, including a leading window number */
|
fit within screen width, including a leading window number */
|
||||||
*(s = w->columnhdr) = '\0';
|
*(s = w->columnhdr) = '\0';
|
||||||
if (Rc.mode_altscr) s = scat(s, " ", w->columnhdr, sizeof(w->columnhdr));
|
if (Rc.mode_altscr) s = scat(s, " ", w->columnhdr, sizeof(w->columnhdr));
|
||||||
|
w->endpflg = 0;
|
||||||
for (i = w->totpflgs - 1; -1 < i; i--) {
|
for (i = w->totpflgs - 1; -1 < i; i--) {
|
||||||
f = w->pflgsall[i];
|
f = w->pflgsall[i];
|
||||||
#ifndef USE_X_COLHDR
|
#ifndef USE_X_COLHDR
|
||||||
|
Loading…
Reference in New Issue
Block a user