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

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