Commit 933e21f1 authored by David Zeuthen's avatar David Zeuthen

Be more careful when determining process start time

parent db1001b4
......@@ -408,8 +408,11 @@ get_start_time_for_pid (pid_t pid,
if (!g_file_get_contents (filename, &contents, &length, error))
goto out;
/* start time is the 19th token after the '(process name)' entry */
p = strchr (contents, ')');
/* start time is the 19th token after the '(process name)' entry - since only this
* field can contain the ')' character, search backwards for this to avoid malicious
* processes trying to fool us
*/
p = strrchr (contents, ')');
if (p == NULL)
{
g_set_error (error,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment