summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2011-02-07 08:04:04 +0200
committerVicent Marti <tanoku@gmail.com>2011-02-07 08:04:04 +0200
commite85c705f5a12fb29bc614f87d41a1fe26042fb71 (patch)
tree26b741cf448fe3110309a3a0377fac8e3cf3ea75 /src
parent13317a5e0f99a74c9bda33a5e20770c158fc863b (diff)
parentfc8afc87d78c79c57b6448f9b92e47f3f2515f38 (diff)
downloadlibgit2-e85c705f5a12fb29bc614f87d41a1fe26042fb71.tar.gz
Merge branch 'join-path-tests' of https://github.com/nulltoken/libgit2
Diffstat (limited to 'src')
-rw-r--r--src/util.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/util.c b/src/util.c
index e1f709962..67b74eeba 100644
--- a/src/util.c
+++ b/src/util.c
@@ -207,6 +207,8 @@ char *git__joinpath(const char *path_a, const char *path_b)
int len_a, len_b;
char *path_new;
+ assert(path_a && path_b);
+
len_a = strlen(path_a);
len_b = strlen(path_b);
@@ -216,7 +218,7 @@ char *git__joinpath(const char *path_a, const char *path_b)
strcpy(path_new, path_a);
- if (path_new[len_a - 1] != '/')
+ if (len_a > 0 && len_b > 0 && path_new[len_a - 1] != '/')
path_new[len_a++] = '/';
if (path_b[0] == '/')