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

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