diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/util.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/util.c b/src/util.c index fc1682f90..2f1bd2220 100644 --- a/src/util.c +++ b/src/util.c @@ -206,6 +206,7 @@ void git__joinpath_n(char *buffer_out, int count, ...) { va_list ap; int i; + char *buffer_start = buffer_out; va_start(ap, count); for (i = 0; i < count; ++i) { @@ -213,9 +214,12 @@ void git__joinpath_n(char *buffer_out, int count, ...) int len; path = va_arg(ap, const char *); - if (i > 0 && *path == '/') + if (i > 0 && *path == '/' && buffer_out > buffer_start && buffer_out[-1] == '/') path++; + if (!*path) + continue; + len = strlen(path); memcpy(buffer_out, path, len); buffer_out = buffer_out + len; |
