Blame SOURCES/0233-abrt-hook-ccpp-save-get_fsuid-return-values-in-int-v.patch

b225ea
From 3853f65022ef450469a6f612fe1ae11ab3f87a8a Mon Sep 17 00:00:00 2001
b225ea
From: Matej Habrnal <mhabrnal@redhat.com>
b225ea
Date: Thu, 26 May 2016 10:15:07 +0200
b225ea
Subject: [PATCH] abrt-hook-ccpp: save get_fsuid() return values in int
b225ea
 variables
b225ea
b225ea
int because get_fsuid() returns negative values in case of error
b225ea
Revealed by coverity.
b225ea
b225ea
Related to: #1337186
b225ea
b225ea
Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
b225ea
---
b225ea
 src/hooks/abrt-hook-ccpp.c | 7 ++++---
b225ea
 1 file changed, 4 insertions(+), 3 deletions(-)
b225ea
b225ea
diff --git a/src/hooks/abrt-hook-ccpp.c b/src/hooks/abrt-hook-ccpp.c
b225ea
index dc4dec6..581a540 100644
b225ea
--- a/src/hooks/abrt-hook-ccpp.c
b225ea
+++ b/src/hooks/abrt-hook-ccpp.c
b225ea
@@ -863,7 +863,8 @@ int main(int argc, char** argv)
b225ea
     char *proc_pid_status = xmalloc_xopen_read_close(path, /*maxsz:*/ NULL);
b225ea
 
b225ea
     uid_t fsuid = uid;
b225ea
-    uid_t tmp_fsuid = get_fsuid(proc_pid_status);
b225ea
+    /* int because get_fsuid() returns negative values in case of error */
b225ea
+    int tmp_fsuid = get_fsuid(proc_pid_status);
b225ea
     if (tmp_fsuid < 0)
b225ea
     {
b225ea
         error_msg_ignore_crash(pid_str, NULL, (long unsigned)uid, signal_no,
b225ea
@@ -879,12 +880,12 @@ int main(int argc, char** argv)
b225ea
     }
b225ea
 
b225ea
     int suid_policy = dump_suid_policy();
b225ea
-    if (tmp_fsuid != uid)
b225ea
+    if ((uid_t)tmp_fsuid != uid)
b225ea
     {
b225ea
         /* use root for suided apps unless it's explicitly set to UNSAFE */
b225ea
         fsuid = 0;
b225ea
         if (suid_policy == DUMP_SUID_UNSAFE)
b225ea
-            fsuid = tmp_fsuid;
b225ea
+            fsuid = (uid_t)tmp_fsuid;
b225ea
         else
b225ea
         {
b225ea
             g_user_core_flags = O_EXCL;
b225ea
-- 
b225ea
1.8.3.1
b225ea