xf86drm: Handle NULL in drmCopyVersion

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.

Related: https://bugs.launchpad.net/bugs/2104352
This commit is contained in:
Daniel van Vugt 2025-03-27 17:41:37 +08:00
parent a7eb2cfd53
commit d387ec976f

View file

@ -1348,11 +1348,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;
}