Commit Diff


commit - 33cbf02b9777cd078e8a37db5ae068465219301c
commit + 455de7fa2c4ca7bb8c24c144e14c235f8d757503
blob - fefe29cbfdc8da1f766b44e0948c98422f901875
blob + 612f8eabe6d1cf8aefde3bc0a3817eb786a9ba74
--- lib/path.c
+++ lib/path.c
@@ -391,9 +391,10 @@ got_path_basename(char **s, const char *path)
 void
 got_path_strip_trailing_slashes(char *path)
 {
-	int x;
+	size_t x;
 
-	while (path[x = strlen(path) - 1] == '/')
+	x = strlen(path);
+	while (x-- > 0 && path[x] == '/')
 		path[x] = '\0';
 }