PolicyKit: Branch 'master'

David Zeuthen david at kemper.freedesktop.org
Fri Dec 7 09:04:00 PST 2007


 src/polkit-dbus/polkit-read-auth-helper.c   |    2 +-
 src/polkit-dbus/polkit-resolve-exe-helper.c |    2 +-
 src/polkit/polkit-authorization.c           |   10 +++++-----
 3 files changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 46005c49dbcdf0655e986fdf45fd869c81498d10
Author: David Zeuthen <davidz at redhat.com>
Date:   Fri Dec 7 12:00:36 2007 -0500

    add additional checks when using strtoul
    
    Pointed out by Martin Pitt <martin.pitt at ubuntu.com>.

diff --git a/src/polkit-dbus/polkit-read-auth-helper.c b/src/polkit-dbus/polkit-read-auth-helper.c
index 4663b68..f2cfea2 100644
--- a/src/polkit-dbus/polkit-read-auth-helper.c
+++ b/src/polkit-dbus/polkit-read-auth-helper.c
@@ -343,7 +343,7 @@ skip_check:
         /*----------------------------------------------------------------------------------------------------*/
 
         requesting_info_for_uid = strtoul (argv[1], &endp, 10);
-        if  (*endp != '\0') {
+        if (strlen (argv[1]) == 0 || *endp != '\0') {
                 fprintf (stderr, "polkit-read-auth-helper: requesting_info_for_uid malformed (3)\n");
                 goto out;
         }
diff --git a/src/polkit-dbus/polkit-resolve-exe-helper.c b/src/polkit-dbus/polkit-resolve-exe-helper.c
index 181e483..18d3260 100644
--- a/src/polkit-dbus/polkit-resolve-exe-helper.c
+++ b/src/polkit-dbus/polkit-resolve-exe-helper.c
@@ -118,7 +118,7 @@ main (int argc, char *argv[])
         /*----------------------------------------------------------------------------------------------------*/
 
         requesting_info_for_pid = strtoul (argv[1], &endp, 10);
-        if  (*endp != '\0') {
+        if (strlen (argv[1]) == 0 || *endp != '\0') {
                 fprintf (stderr, "polkit-resolve-exe-helper: requesting_info_for_pid malformed\n");
                 goto out;
         }
diff --git a/src/polkit/polkit-authorization.c b/src/polkit/polkit-authorization.c
index 25ef297..5feda23 100644
--- a/src/polkit/polkit-authorization.c
+++ b/src/polkit/polkit-authorization.c
@@ -183,7 +183,7 @@ _parse_entry (const char *key, const char *value, void *user_data)
                 epd->cur_attr |= ATTR_PID;
 
                 auth->pid = strtoul (value, &ep, 10);
-                if (*ep != '\0')
+                if (strlen (value) == 0 || *ep != '\0')
                         goto error;
 
         } else if (strcmp (key, "pid-start-time") == 0) {
@@ -193,7 +193,7 @@ _parse_entry (const char *key, const char *value, void *user_data)
                 epd->cur_attr |= ATTR_PID_START_TIME;
 
                 auth->pid_start_time = strtoull (value, &ep, 10);
-                if (*ep != '\0')
+                if (strlen (value) == 0 || *ep != '\0')
                         goto error;
 
         } else if (strcmp (key, "session-id") == 0) {
@@ -225,7 +225,7 @@ _parse_entry (const char *key, const char *value, void *user_data)
                 epd->cur_attr |= ATTR_WHEN;
 
                 auth->when = strtoull (value, &ep, 10);
-                if (*ep != '\0')
+                if (strlen (value) == 0 || *ep != '\0')
                         goto error;
 
         } else if (strcmp (key, "auth-as") == 0) {
@@ -235,7 +235,7 @@ _parse_entry (const char *key, const char *value, void *user_data)
                 epd->cur_attr |= ATTR_AUTH_AS;
 
                 auth->authenticated_as_uid = strtoul (value, &ep, 10);
-                if (*ep != '\0')
+                if (strlen (value) == 0 || *ep != '\0')
                         goto error;
 
         } else if (strcmp (key, "granted-by") == 0) {
@@ -245,7 +245,7 @@ _parse_entry (const char *key, const char *value, void *user_data)
                 epd->cur_attr |= ATTR_GRANTED_BY;
 
                 auth->explicitly_granted_by = strtoul (value, &ep, 10);
-                if (*ep != '\0')
+                if (strlen (value) == 0 || *ep != '\0')
                         goto error;
 
         } else if (strcmp (key, "constraint") == 0) {


More information about the hal-commit mailing list