From ac9bcdee31760a12ec317fde7536976bbcfc25d2 Mon Sep 17 00:00:00 2001 From: "Jan Alexander Steffens (heftig)" Date: Sat, 13 Mar 2021 20:09:03 +0100 Subject: [PATCH] pulse-server: Error out if pid file name would be too long --- src/modules/module-protocol-pulse/pulse-server.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/modules/module-protocol-pulse/pulse-server.c b/src/modules/module-protocol-pulse/pulse-server.c index faaf5e1fd..d9989a541 100644 --- a/src/modules/module-protocol-pulse/pulse-server.c +++ b/src/modules/module-protocol-pulse/pulse-server.c @@ -6015,6 +6015,10 @@ static int create_pid_file(void) { if ((res = get_runtime_dir(pid_file, sizeof(pid_file), "pulse")) < 0) { return res; } + if (strlen(pid_file) > PATH_MAX - 5) { + pw_log_error(NAME" %s/pid too long", pid_file); + return -ENAMETOOLONG; + } strcat(pid_file, "/pid"); snprintf(pid_str, sizeof(pid_str), "%lu\n", (unsigned long)getpid());