Blame SOURCES/0001-xfree86-ensure-the-readlink-buffer-is-null-terminate.patch

f34ecf
From 71703e4e8bd00719eefad53c2ed6c604079f87ea Mon Sep 17 00:00:00 2001
f34ecf
From: rpm-build <rpm-build>
f34ecf
Date: Wed, 17 Oct 2018 09:00:59 +1000
f34ecf
Subject: [PATCH xserver] xfree86: ensure the readlink buffer is
f34ecf
 null-terminated
f34ecf
f34ecf
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
f34ecf
Reviewed-by: Dave Airlie <airlied@redhat.com>
f34ecf
---
f34ecf
 hw/xfree86/fbdevhw/fbdevhw.c | 4 ++--
f34ecf
 1 file changed, 2 insertions(+), 2 deletions(-)
f34ecf
f34ecf
diff --git a/hw/xfree86/fbdevhw/fbdevhw.c b/hw/xfree86/fbdevhw/fbdevhw.c
f34ecf
index 95089515c..f146ff4a4 100644
f34ecf
--- a/hw/xfree86/fbdevhw/fbdevhw.c
f34ecf
+++ b/hw/xfree86/fbdevhw/fbdevhw.c
f34ecf
@@ -331,12 +331,12 @@ fbdev_open(int scrnIndex, const char *dev, char **namep)
f34ecf
 
f34ecf
     /* only touch non-PCI devices on this path */
f34ecf
     {
f34ecf
-        char buf[PATH_MAX];
f34ecf
+        char buf[PATH_MAX] = {0};
f34ecf
         char *sysfs_path = NULL;
f34ecf
         char *node = strrchr(dev, '/') + 1;
f34ecf
 
f34ecf
         if (asprintf(&sysfs_path, "/sys/class/graphics/%s", node) < 0 ||
f34ecf
-            readlink(sysfs_path, buf, sizeof(buf)) < 0 ||
f34ecf
+            readlink(sysfs_path, buf, sizeof(buf) - 1) < 0 ||
f34ecf
             strstr(buf, "devices/pci")) {
f34ecf
             free(sysfs_path);
f34ecf
             close(fd);
f34ecf
-- 
f34ecf
2.19.1
f34ecf