summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Zeuthen <davidz@redhat.com>2009-08-10 10:17:51 -0400
committerDavid Zeuthen <davidz@redhat.com>2009-08-10 10:17:51 -0400
commit933e21f13a44c556dcc1e4ce5c2493baf785ee76 (patch)
treeed3c6b21ba842a2313ea3ac3106c8338a4c70429 /src
parentdb1001b48e5ecaf792f5b3648f5dbc7e87ff19ad (diff)
downloadpolkit-933e21f13a44c556dcc1e4ce5c2493baf785ee76.tar.gz
Be more careful when determining process start time
Diffstat (limited to 'src')
-rw-r--r--src/polkit/polkitunixprocess.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/polkit/polkitunixprocess.c b/src/polkit/polkitunixprocess.c
index 0a410be..b75203f 100644
--- a/src/polkit/polkitunixprocess.c
+++ b/src/polkit/polkitunixprocess.c
@@ -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,