xfree86: bail on misformed acpi strings (#73227)

If acpid sends a string in a format that we can't parse, bail out instead of
potentially dereferencing a NULL-pointer.

X.Org Bug 73227 <http://bugs.freedesktop.org/show_bug.cgi?id=73227>

Signed-off-by: Ted Felix <ted@tedfelix.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Ted Felix 2013-01-29 16:36:48 +10:00 committed by Peter Hutterer
parent fdc4515888
commit 3d35dfcf5b

View File

@ -82,18 +82,21 @@ lnxACPIGetEventFromOs(int fd, pmEvent * events, int num)
video = strtok(ev, " ");
GFX = strtok(NULL, " ");
if (!(GFX = strtok(NULL, " ")))
return 0;
#if 0
ErrorF("GFX: %s\n", GFX);
#endif
notify = strtok(NULL, " ");
if (!(notify = strtok(NULL, " ")))
return 0;
notify_l = strtoul(notify, NULL, 16);
#if 0
ErrorF("notify: 0x%lx\n", notify_l);
#endif
data = strtok(NULL, " ");
if (!(data = strtok(NULL, " ")))
return 0;
data_l = strtoul(data, NULL, 16);
#if 0
ErrorF("data: 0x%lx\n", data_l);