PolicyKit: Branch 'master'

David Zeuthen david at kemper.freedesktop.org
Mon Aug 10 07:21:01 PDT 2009


 src/polkit/polkitunixprocess.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 933e21f13a44c556dcc1e4ce5c2493baf785ee76
Author: David Zeuthen <davidz at redhat.com>
Date:   Mon Aug 10 10:17:51 2009 -0400

    Be more careful when determining process start time

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,


More information about the hal-commit mailing list