From 06844b6eaefb03c65d9b84a5b8503449ed275bc8 Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Thu, 11 Feb 2021 21:38:31 +0000 Subject: [PATCH] Revert "xf86drm: cap number of reported devices by drmGetDevice(2)" This reverts commit 8cb12a2528d795c45bba5f03b3486b4040fb0f45. The commit fixed the OOB, yet it broke drmDevices2(0, NULL, 0) - aka we did not return the total devices list. Reviewed-by: Simon Ser --- xf86drm.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/xf86drm.c b/xf86drm.c index 35c3566c..dbb7c14b 100644 --- a/xf86drm.c +++ b/xf86drm.c @@ -4263,13 +4263,12 @@ drm_public int drmGetDevices2(uint32_t flags, drmDevicePtr devices[], if (!local_devices[i]) continue; - if ((devices != NULL) && (device_count < max_devices)) { + if ((devices != NULL) && (device_count < max_devices)) devices[device_count] = local_devices[i]; - device_count++; - } else { + else drmFreeDevice(&local_devices[i]); - } + device_count++; } closedir(sysdir);