diff --git a/src/path.c b/src/path.c
index 6d07d3d50a550b02c4d8c0ecac5e0b8404d7ea0c..6ff5412bb7319a4675052925adafb41207689142 100644
--- a/src/path.c
+++ b/src/path.c
@@ -130,7 +130,7 @@ char *path_real_rec(char *cur, int *links) {
   int i, j, n, tmpl, lnkl = 0;
   char **arr, *tmp, *lnk, *ret = NULL;
 
-  tmpl = strlen(cur);
+  tmpl = strlen(cur)+1;
   tmp = malloc(tmpl);
 
   /* split path */