0098-top: Check i when setting Curwin in config_file().

Otherwise it leads to out-of-bounds reads (and maybe writes).
This commit is contained in:
Qualys Security Advisory 1970-01-01 00:00:00 +00:00 committed by Craig Small
parent 7c92bff183
commit 0b0356de5c

View File

@ -3225,6 +3225,8 @@ static const char *config_file (FILE *fp, const char *name, float *delay) {
if (Rc.id < 'a' || Rc.id > RCF_VERSION_ID)
return p;
// you saw that, right? (fscanf stickin' it to 'i')
if (i < 0 || i >= GROUPSMAX)
return p;
Curwin = &Winstk[i];
// this may be ugly, but it keeps us locale independent...
*delay = (float)tmp_whole + (float)tmp_fract / 1000;