mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-24 21:34:08 +03: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:
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user