From c429ae2f0790c3486e7e420f4f2883c6a530ccf0 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Thu, 6 May 2021 00:34:05 -0400 Subject: No sep ending (#2) * Be extra sure not to inject a separator at the end of the output string --- lib/cleanpath.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/cleanpath.c b/lib/cleanpath.c index f94c66d..c7f8bc9 100644 --- a/lib/cleanpath.c +++ b/lib/cleanpath.c @@ -102,7 +102,7 @@ char *cleanpath_read(struct CleanPath *path) { strcat(result, path->part[i]); // Do not append path separator on final element - if (path->part[i + 1] != NULL) { + if (path->part[i + 1] != NULL && *path->part[i + 1] != '\0') { strcat(result, path->sep); } } -- cgit