From cbeeb4ccbf152e555868bfaa54a9b43fdd61f196 Mon Sep 17 00:00:00 2001 From: Anton Kindestam Date: Thu, 16 Feb 2017 12:20:14 +0100 Subject: Fix NULL-pointer bug in get_pathname when running with -mdrm --- src/servers/kernel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/servers') diff --git a/src/servers/kernel.c b/src/servers/kernel.c index 4ccbe9c..1600d0a 100644 --- a/src/servers/kernel.c +++ b/src/servers/kernel.c @@ -85,7 +85,7 @@ static char* get_pathname(const char* restrict suffix) username = pw->pw_name ? pw->pw_name : ""; n = sizeof("/.coopgammad/~/.") + 3 * sizeof(int); - n += strlen(rundir) + strlen(username) + strlen(name) + strlen(suffix); + n += strlen(rundir) + strlen(username) + ((name != NULL) ? strlen(name) : 0) + strlen(suffix); if (!(rc = malloc(n))) goto fail; sprintf(rc, "%s/.coopgammad/~%s/%i%s%s%s", -- cgit v1.2.3-70-g09d2