[PATCH v2] compositor: Fix buggy snprintf that sets module path

Chad Versace chad.versace at linux.intel.com
Wed May 23 23:42:15 PDT 2012


If the MODULEDIR string contains '%', then
    snprintf(path, sizeof(path), MODULEDIR "/%s", name);
does not do what you want.

Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
---
 src/compositor.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/compositor.c b/src/compositor.c
index 3c1e058..c56a246 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -2774,7 +2774,7 @@ load_module(const char *name, const char *entrypoint, void **handle)
 	void *module, *init;
 
 	if (name[0] != '/')
-		snprintf(path, sizeof path, MODULEDIR "/%s", name);
+		snprintf(path, sizeof path, "%s/%s", MODULEDIR, name);
 	else
 		snprintf(path, sizeof path, "%s", name);
 
-- 
1.7.10.2



More information about the wayland-devel mailing list