xf86drm: Handle NULL in drmCopyVersion
authorDaniel van Vugt <daniel.van.vugt@canonical.com>
Thu, 27 Mar 2025 09:41:37 +0000 (17:41 +0800)
committerTimo Aaltonen <tjaalton@debian.org>
Tue, 1 Apr 2025 08:08:19 +0000 (11:08 +0300)
Just as it is already handled in the caller, `drmGetVersion`.

I'm not sure what the offending driver is, but the Ubuntu incidents
seem to be coming from a dual Intel/Nvidia machine. And they show
it is `card1` so I'm guessing `nvidia-drm` is the offender.

Bug-Ubuntu: https://bugs.launchpad.net/bugs/2104352

Gbp-Pq: Name xf86drm-Handle-NULL-in-drmCopyVersion.patch

xf86drm.c

index 6ca5626363f10e7247638fb2dadea650d429d43f..b5db5775ea5ca4e6f4cb6e465c7f950bc55f317b 100644 (file)
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -1343,11 +1343,11 @@ static void drmCopyVersion(drmVersionPtr d, const drm_version_t *s)
     d->version_minor      = s->version_minor;
     d->version_patchlevel = s->version_patchlevel;
     d->name_len           = s->name_len;
-    d->name               = strdup(s->name);
+    d->name               = s->name ? strdup(s->name) : NULL;
     d->date_len           = s->date_len;
-    d->date               = strdup(s->date);
+    d->date               = s->date ? strdup(s->date) : NULL;
     d->desc_len           = s->desc_len;
-    d->desc               = strdup(s->desc);
+    d->desc               = s->desc ? strdup(s->desc) : NULL;
 }