mirror of
https://github.com/morgan9e/systemd
synced 2026-04-15 08:56:15 +09:00
process-util: fix two bugs in get_process_cmdline() (#3555)
See: https://github.com/systemd/systemd/pull/3529#issuecomment-226421007
This commit is contained in:
committed by
Zbigniew Jędrzejewski-Szmek
parent
749a1d0684
commit
b09df4e21d
@@ -161,6 +161,8 @@ int get_process_cmdline(pid_t pid, size_t max_length, bool comm_fallback, char *
|
||||
|
||||
if (len > 0)
|
||||
r[len] = 0;
|
||||
else
|
||||
r = mfree(r);
|
||||
|
||||
} else {
|
||||
bool dotdotdot = false;
|
||||
@@ -214,7 +216,7 @@ int get_process_cmdline(pid_t pid, size_t max_length, bool comm_fallback, char *
|
||||
}
|
||||
|
||||
strncpy(k, "...", left-1);
|
||||
k[left] = 0;
|
||||
k[left-1] = 0;
|
||||
} else
|
||||
*k = 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user