void-packages/srcpkgs/xorg-server/patches/fix-libfbdevhw.patch

27 lines
935 B
Diff

source upstream master:
Misplaced parenthesis caused us to compare the sizeof,
not the readlink return value.
https://gitlab.freedesktop.org/xorg/xserver/commit/bd5fe7593fd0df236f3b2be1f062166ddba7d67c
ensure the readlink buffer is null-terminated
https://gitlab.freedesktop.org/xorg/xserver/commit/71703e4e8bd00719eefad53c2ed6c604079f87ea
--- hw/xfree86/fbdevhw/fbdevhw.c.orig
+++ hw/xfree86/fbdevhw/fbdevhw.c
@@ -331,12 +331,12 @@
/* 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);