[SSSD] [PATCH] Prevent using uninitialized "group_name" in done section.

Lukas Slebodnik lslebodn at redhat.com
Thu Jul 25 11:30:25 UTC 2013


ehlo,

Commit bfd59d1a2d0d45125e5164ef12c425690d519f61 introduced new Coverity issue.
In case of failure, variable group_name can be used uninitialized in DEBUG
macro.

#         DEBUG(SSSDBG_MINOR_FAILURE,
#               ("Failed to save group [%s]: [%s]\n",
#-               name ? name : "Unknown",
#+               group_name ? group_name : "Unknown",
                ^^^^^^^^^^
        uninit_use: Using uninitialized value "group_name".
#                strerror(ret)));

Before this commit, variable name was used in the same place and
variable name was initialized to NULL.

I suppose that we should run coverity scan in the review proces
(either automatically patchwork??? or manually)

Patch is attached.

LS
-------------- next part --------------
>From 36ae07e1e41d1c8aeb9f113ed5cf72d511b1f376 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Thu, 25 Jul 2013 13:14:10 +0200
Subject: [PATCH] Prevent using uninitialized "group_name" in done section.

Coverity ID: 11927
---
 src/providers/ldap/sdap_async_groups.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/providers/ldap/sdap_async_groups.c b/src/providers/ldap/sdap_async_groups.c
index aa30cd0b56a2a14445dd20e0e902267a51fc07ba..9f667320aa0500eddd59d29d0e8975d5dffac2ca 100644
--- a/src/providers/ldap/sdap_async_groups.c
+++ b/src/providers/ldap/sdap_async_groups.c
@@ -428,7 +428,7 @@ static int sdap_save_group(TALLOC_CTX *memctx,
 {
     struct ldb_message_element *el;
     struct sysdb_attrs *group_attrs;
-    const char *group_name;
+    const char *group_name = NULL;
     gid_t gid;
     errno_t ret;
     char *usn_value = NULL;
-- 
1.8.3.1



More information about the sssd-devel mailing list