pulse-server: Error out if pid file name would be too long

This commit is contained in:
Jan Alexander Steffens (heftig) 2021-03-13 20:09:03 +01:00
parent 6e2f78fffc
commit ac9bcdee31
No known key found for this signature in database
GPG key ID: 3B94A80E50A477C7

View file

@ -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());