f224e547f4
Resolves: rhbz#1962006
52 lines
1.9 KiB
Diff
52 lines
1.9 KiB
Diff
From 9777427facccbbe45c855b0319258335dffb986a Mon Sep 17 00:00:00 2001
|
|
From: Alexey Tikhonov <atikhono@redhat.com>
|
|
Date: Tue, 18 May 2021 12:04:01 +0200
|
|
Subject: [PATCH 3/5] UTIL/SECRETS: mistype fix
|
|
|
|
Wrong variable was tested after mem allocation.
|
|
|
|
Also fixes following covscan issues:
|
|
```
|
|
Error: DEADCODE (CWE-561):
|
|
sssd-2.5.0/src/util/secrets/secrets.c:1004: cond_notnull: Condition "uuid_list == NULL", taking false branch. Now the value of "uuid_list" is not "NULL".
|
|
sssd-2.5.0/src/util/secrets/secrets.c:1010: notnull: At condition "uuid_list == NULL", the value of "uuid_list" cannot be "NULL".
|
|
sssd-2.5.0/src/util/secrets/secrets.c:1010: dead_error_condition: The condition "uuid_list == NULL" cannot be true.
|
|
sssd-2.5.0/src/util/secrets/secrets.c:1011: dead_error_begin: Execution cannot reach this statement: "ret = 12;".
|
|
# 1009| uid_list = talloc_zero_array(tmp_ctx, const char *, res->count);
|
|
# 1010| if (uuid_list == NULL) {
|
|
# 1011|-> ret = ENOMEM;
|
|
# 1012| goto done;
|
|
# 1013| }
|
|
```
|
|
|
|
Reviewed-by: Justin Stephenson <jstephen@redhat.com>
|
|
---
|
|
src/util/secrets/secrets.c | 6 +++---
|
|
1 file changed, 3 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/src/util/secrets/secrets.c b/src/util/secrets/secrets.c
|
|
index 2801eb24263ef8116a7afc294ee91a863295f5be..6e99e291dd355cc69b0d872f53624ca3446e18ad 100644
|
|
--- a/src/util/secrets/secrets.c
|
|
+++ b/src/util/secrets/secrets.c
|
|
@@ -1002,14 +1002,14 @@ errno_t sss_sec_list_cc_uuids(TALLOC_CTX *mem_ctx,
|
|
goto done;
|
|
}
|
|
|
|
- uuid_list = talloc_zero_array(tmp_ctx, const char *, res->count);
|
|
+ uuid_list = talloc_zero_array(tmp_ctx, const char *, res->count);
|
|
if (uuid_list == NULL) {
|
|
ret = ENOMEM;
|
|
goto done;
|
|
}
|
|
|
|
- uid_list = talloc_zero_array(tmp_ctx, const char *, res->count);
|
|
- if (uuid_list == NULL) {
|
|
+ uid_list = talloc_zero_array(tmp_ctx, const char *, res->count);
|
|
+ if (uid_list == NULL) {
|
|
ret = ENOMEM;
|
|
goto done;
|
|
}
|
|
--
|
|
2.30.2
|
|
|