libselinux/0011-libselinux-getconlist-free-memory-on-multiple-level-.patch
Petr Lautrbach 3b5b188591 libselinux-3.2-3
- selinux_check_passwd_access_internal(): respect deny_unknown
- Silence -Wstringop-overflow warning from gcc 10.3.1
- Fixed misc compiler and static analyzer findings

Resolves: rhbz#1938789
2021-05-25 15:44:10 +02:00

35 lines
1.0 KiB
Diff

From 809615a5b204e3e8426d363d62717785401618ec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= <cgzones@googlemail.com>
Date: Mon, 3 May 2021 17:10:55 +0200
Subject: [PATCH] libselinux: getconlist: free memory on multiple level
arguments
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Do not leak memory if the program argument `l` got passed more than
once.
Found by clang-analyzer.
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
---
libselinux/utils/getconlist.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/libselinux/utils/getconlist.c b/libselinux/utils/getconlist.c
index 76654b75151a..0bb2846937ca 100644
--- a/libselinux/utils/getconlist.c
+++ b/libselinux/utils/getconlist.c
@@ -26,6 +26,7 @@ int main(int argc, char **argv)
while ((opt = getopt(argc, argv, "l:")) > 0) {
switch (opt) {
case 'l':
+ free(level);
level = strdup(optarg);
if (!level) {
fprintf(stderr, "memory allocation failure: %d(%s)\n",
--
2.32.0.rc1