f1133c
From becc1c297279f757835943e2cad63992134511f9 Mon Sep 17 00:00:00 2001
f1133c
From: Sergio Correia <scorreia@redhat.com>
f1133c
Date: Mon, 7 Mar 2022 13:11:09 -0300
f1133c
Subject: [PATCH] auparse: fix off-by-one issue in path_norm() (#242)
f1133c
f1133c
When defining dest = rpath + 1, we end up having the first char of
f1133c
`dest' as NULL -- since `rpath' points to `working', which is a static
f1133c
buffer.
f1133c
f1133c
With the first char as NULL, path_norm() ends up producing an empty string.
f1133c
f1133c
This commit fixes the issue reported in this [1] mailing list post.
f1133c
f1133c
[1] https://listman.redhat.com/archives/linux-audit/2022-February/018844.html
f1133c
---
f1133c
 auparse/interpret.c | 2 +-
f1133c
 1 file changed, 1 insertion(+), 1 deletion(-)
f1133c
f1133c
diff --git a/auparse/interpret.c b/auparse/interpret.c
f1133c
index c8a0d96dd..df593c44c 100644
f1133c
--- a/auparse/interpret.c
f1133c
+++ b/auparse/interpret.c
f1133c
@@ -895,7 +895,7 @@ static char *path_norm(const char *name)
f1133c
 		return strdup(name);
f1133c
 
f1133c
 	rpath = working;
f1133c
-	dest = rpath + 1;
f1133c
+	dest = rpath;
f1133c
 	rpath_limit = rpath + PATH_MAX;
f1133c
 
f1133c
 	for (start = name; *start; start = end) {