From 80accc08cbf9edddd4cb13f8c93e6ec47d5d3833 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Wed, 7 May 2025 14:56:59 +0200 Subject: [PATCH] (!1969) xfree86: loader: add assert() in LoadModule() There's (remote) chance that the (internal) module name could become NULL (eg. allocation failure). Even though chances to hit it are very low, it's still better to have a check here (that doesn't cost us much), just in case. Assert fail is still better than segfault, since we're at least getting some hint what might have happened. Signed-off-by: Enrico Weigelt, metux IT consult --- hw/xfree86/loader/loadmod.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c index 2edc14ac7..0cf5ea569 100644 --- a/hw/xfree86/loader/loadmod.c +++ b/hw/xfree86/loader/loadmod.c @@ -702,6 +702,8 @@ LoadModule(const char *module, void *options, const XF86ModReqInfo *modreq, if (!strcmp(m, "vbe")) m = name = strdup("int10"); + assert(m); + for (cim = compiled_in_modules; *cim; cim++) if (!strcmp(m, *cim)) { LogMessageVerb(X_INFO, 3, "Module \"%s\" already built-in\n", m);