xserver: Branch 'master'

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Oct 16 23:43:33 UTC 2018


 hw/xfree86/fbdevhw/fbdevhw.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 71703e4e8bd00719eefad53c2ed6c604079f87ea
Author: rpm-build <rpm-build>
Date:   Wed Oct 17 09:00:59 2018 +1000

    xfree86: ensure the readlink buffer is null-terminated
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Dave Airlie <airlied at redhat.com>

diff --git a/hw/xfree86/fbdevhw/fbdevhw.c b/hw/xfree86/fbdevhw/fbdevhw.c
index 95089515c..f146ff4a4 100644
--- a/hw/xfree86/fbdevhw/fbdevhw.c
+++ b/hw/xfree86/fbdevhw/fbdevhw.c
@@ -331,12 +331,12 @@ fbdev_open(int scrnIndex, const char *dev, char **namep)
 
     /* only touch non-PCI devices on this path */
     {
-        char buf[PATH_MAX];
+        char buf[PATH_MAX] = {0};
         char *sysfs_path = NULL;
         char *node = strrchr(dev, '/') + 1;
 
         if (asprintf(&sysfs_path, "/sys/class/graphics/%s", node) < 0 ||
-            readlink(sysfs_path, buf, sizeof(buf)) < 0 ||
+            readlink(sysfs_path, buf, sizeof(buf) - 1) < 0 ||
             strstr(buf, "devices/pci")) {
             free(sysfs_path);
             close(fd);


More information about the xorg-commit mailing list