Blame SOURCES/0025-owner-Fix-potential-array-out-of-bounds-access.patch

b59ec1
From d6087e02d9f25bba362db0af16355ee3be4e450a Mon Sep 17 00:00:00 2001
b59ec1
From: Phil Sutter <psutter@redhat.com>
b59ec1
Date: Tue, 21 Feb 2023 19:50:40 +0100
b59ec1
Subject: [PATCH] owner: Fix potential array out of bounds access
b59ec1
b59ec1
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2160049
b59ec1
Upstream Status: nftables commit 9967911e3dabb
b59ec1
b59ec1
commit 9967911e3dabb32901617e81e56602af3b37287f
b59ec1
Author: Pablo Neira Ayuso <pablo@netfilter.org>
b59ec1
Date:   Wed Dec 21 17:37:46 2022 +0100
b59ec1
b59ec1
    owner: Fix potential array out of bounds access
b59ec1
b59ec1
    If the link target length exceeds 'sizeof(tmp)' bytes, readlink() will
b59ec1
    return 'sizeof(tmp)'. Using this value as index is illegal.
b59ec1
b59ec1
    Original update from Phil, for the conntrack-tools tree, which also has
b59ec1
    a copy of this function.
b59ec1
b59ec1
    Fixes: 6d085b22a8b5 ("table: support for the table owner flag")
b59ec1
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
b59ec1
b59ec1
Signed-off-by: Phil Sutter <psutter@redhat.com>
b59ec1
---
b59ec1
 src/owner.c | 2 +-
b59ec1
 1 file changed, 1 insertion(+), 1 deletion(-)
b59ec1
b59ec1
diff --git a/src/owner.c b/src/owner.c
b59ec1
index 2d98a2e..20bed38 100644
b59ec1
--- a/src/owner.c
b59ec1
+++ b/src/owner.c
b59ec1
@@ -66,7 +66,7 @@ static char *portid2name(pid_t pid, uint32_t portid, unsigned long inode)
b59ec1
 			continue;
b59ec1
 
b59ec1
 		rl = readlink(procname, tmp, sizeof(tmp));
b59ec1
-		if (rl <= 0 || rl > (ssize_t)sizeof(tmp))
b59ec1
+		if (rl <= 0 || rl >= (ssize_t)sizeof(tmp))
b59ec1
 			continue;
b59ec1
 
b59ec1
 		tmp[rl] = 0;
b59ec1
-- 
b59ec1
2.39.2
b59ec1