Skip to content

Commit 4f01ca0

Browse files
committed
Adjust path_norm for malformed input
Updated path normalization to remove the pre-decrement from its backtracking loop, using a post-check that safely walks backward through components.
1 parent 2994915 commit 4f01ca0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

auparse/interpret.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,8 @@ static char *path_norm(const char *name)
925925
else if (end - start == 2 && start[0] == '.' &&
926926
start[1] == '.') {
927927
// Back up to previous component, ignore if root
928-
while (dest > rpath && (--dest)[-1] != '/');
928+
while (dest > rpath && dest[-1] != '/')
929+
--dest;
929930
} else {
930931
// we need to insert a '/' if we are at the beginning
931932
// and the path is absolute or we've found the next component

0 commit comments

Comments
 (0)