From aeb3cef10158a1c621d58c6d982e53569e40c6c0 Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik Date: Wed, 13 Apr 2016 21:44:37 +0200 Subject: SYSDB_SUDO: Remove useless test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The function sysdb_search_custom cannot return EOK and together set output argument count to zero. This case is already handled in function sysdb_search_entry which is used inside sysdb_search_custom. Such useless test can just cause read of unitialized variable in case of other errors returned from sysdb_search_custom. Error: UNINIT (CWE-457): [#def1] sssd-1.13.4/src/db/sysdb_sudo.c:678: var_decl: Declaring variable "count" without initializer. sssd-1.13.4/src/db/sysdb_sudo.c:698: uninit_use: Using uninitialized value "count". # 696| SUDORULE_SUBDIR, attrs, # 697| &count, &msgs); # 698|-> if (ret == ENOENT || count == 0) { # 699| DEBUG(SSSDBG_TRACE_FUNC, "No rules matched\n"); # 700| ret = EOK; Reviewed-by: Pavel Březina --- src/db/sysdb_sudo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/db') diff --git a/src/db/sysdb_sudo.c b/src/db/sysdb_sudo.c index 76116abac..cdea5beed 100644 --- a/src/db/sysdb_sudo.c +++ b/src/db/sysdb_sudo.c @@ -695,7 +695,7 @@ sysdb_sudo_purge_byfilter(struct sss_domain_info *domain, ret = sysdb_search_custom(tmp_ctx, domain, filter, SUDORULE_SUBDIR, attrs, &count, &msgs); - if (ret == ENOENT || count == 0) { + if (ret == ENOENT) { DEBUG(SSSDBG_TRACE_FUNC, "No rules matched\n"); ret = EOK; goto done; -- cgit