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

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