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