summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2017-11-13 16:34:46 +0100
committerLeah Neukirchen <leah@vuxu.org>2017-11-13 16:34:46 +0100
commit5761e27db9bdf54ad3cec3571950ccb69206427c (patch)
tree15475a67b661e3c9622e3cf702c7c44b2690880d
parent589243c74c93bef948dfdd2dc3613041c58b6918 (diff)
downloadlr-5761e27db9bdf54ad3cec3571950ccb69206427c.tar.gz
lr-5761e27db9bdf54ad3cec3571950ccb69206427c.tar.xz
lr-5761e27db9bdf54ad3cec3571950ccb69206427c.zip
traverse: avoid out of bounds read
-rw-r--r--lr.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lr.c b/lr.c
index 08d849f..c680cd8 100644
--- a/lr.c
+++ b/lr.c
@@ -2259,7 +2259,7 @@ traverse(const char *path)
 	}
 
 	prefixl = strlen(path);
-	while (path[prefixl-1] == '/')
+	while (prefixl && path[prefixl-1] == '/')
 		prefixl--;
 	if (prefixl > PATH_MAX) {
 		errno = ENAMETOOLONG;