Also removes an unnecessary range check (since it's already handled
by strtoint32()

Fixes: https://fedorahosted.org/sssd/ticket/1216
From 984d1171270a41415342c1acd113e759c2fc28c8 Mon Sep 17 00:00:00 2001
From: Stephen Gallagher <sgall...@redhat.com>
Date: Wed, 29 Feb 2012 10:37:41 -0500
Subject: [PATCH] Handle cases where UID is -1

Also removes an unnecessary range check (since it's already handled
by strtoint32()

https://fedorahosted.org/sssd/ticket/1216
---
 src/util/find_uid.c |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)

diff --git a/src/util/find_uid.c b/src/util/find_uid.c
index f4156ce761ee6d9d3b750e1b5e4576152d318b44..77b9f22a83089ad44e6bda75615cad55b49ff8f4 100644
--- a/src/util/find_uid.c
+++ b/src/util/find_uid.c
@@ -137,7 +137,7 @@ static errno_t get_uid_from_pid(const pid_t pid, uid_t *uid)
         } else {
             *e = '\0';
         }
-        num = strtouint32(p, &endptr, 10);
+        num = (uint32_t) strtoint32(p, &endptr, 10);
         error = errno;
         if (error != 0) {
             DEBUG(1, ("strtol failed [%s].\n", strerror(error)));
@@ -148,11 +148,6 @@ static errno_t get_uid_from_pid(const pid_t pid, uid_t *uid)
             return EINVAL;
         }
 
-        if (num >= UINT32_MAX) {
-            DEBUG(1, ("uid out of range.\n"));
-            return ERANGE;
-        }
-
     } else {
         DEBUG(1, ("format error\n"));
         return EINVAL;
-- 
1.7.7.6

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/sssd-devel

Reply via email to