summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Felix <ted@tedfelix.com>2013-01-29 16:36:48 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2013-02-08 13:47:23 +1000
commit3d35dfcf5bad1b0a028fbecd65cb6cf6ebf12503 (patch)
tree7ab33b036368c5640baf110aa90ec6011a560d72
parentfdc451588816c4bc798d54e56316530e9066be80 (diff)
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>
-rw-r--r--hw/xfree86/os-support/linux/lnx_acpi.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/hw/xfree86/os-support/linux/lnx_acpi.c b/hw/xfree86/os-support/linux/lnx_acpi.c
index d98efa247..dcaa19ee1 100644
--- a/hw/xfree86/os-support/linux/lnx_acpi.c
+++ b/hw/xfree86/os-support/linux/lnx_acpi.c
@@ -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);