Coverity #488: Avoid smashing an array on malformed config files.

This commit is contained in:
Adam Jackson 2006-04-07 01:53:43 +00:00
parent 20c1ef2cc3
commit 75a9afdbf4
2 changed files with 8 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2006-04-06 Adam Jackson <ajax@freedesktop.org>
* hw/xfree86/parser/Monitor.c:
Coverity #488: Avoid smashing an array on malformed config
files.
2006-04-06 Adam Jackson <ajax@freedesktop.org>
* hw/dmx/glxProxy/glxsingle.c:

View File

@ -460,6 +460,8 @@ xf86parseMonitorSection (void)
if (xf86getSubToken (&(ptr->mon_comment)) != NUMBER)
Error (HORIZSYNC_MSG, NULL);
do {
if (ptr->mon_n_hsync >= CONF_MAX_HSYNC)
Error ("Sorry. Too many horizontal sync intervals.", NULL);
ptr->mon_hsync[ptr->mon_n_hsync].lo = val.realnum;
switch (token = xf86getSubToken (&(ptr->mon_comment)))
{
@ -485,8 +487,6 @@ xf86parseMonitorSection (void)
ptr->mon_n_hsync++;
goto HorizDone;
}
if (ptr->mon_n_hsync >= CONF_MAX_HSYNC)
Error ("Sorry. Too many horizontal sync intervals.", NULL);
ptr->mon_n_hsync++;
} while ((token = xf86getSubToken (&(ptr->mon_comment))) == NUMBER);
HorizDone: