diff options
author | 2020-04-26 13:54:12 +0530 | |
---|---|---|
committer | 2020-04-26 13:54:12 +0530 | |
commit | 33fdbc2216d3e91c9e911ecf4366b09c029346ba (patch) | |
tree | 9bdf8058e6139b7846e64ebe5d372967e8b62400 /src | |
parent | 6689870460e5cc32544c5622359883870c43b58d (diff) | |
download | nnn-33fdbc2216d3e91c9e911ecf4366b09c029346ba.tar.gz |
Fix #537
Diffstat (limited to 'src')
-rw-r--r-- | src/nnn.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -1040,7 +1040,12 @@ static char *abspath(const char *path, const char *cwd) size_t dst_size = 0, src_size = xstrlen(path), cwd_size = xstrlen(cwd); const char *src; char *dst; - char *resolved_path = malloc(src_size + (*path == '/' ? 0 : cwd_size) + 1); + /* + * We need to add 2 chars at the end as relative paths may start with: + * ./ (find .) + * no separator (fd .): this needs an additional char for '/' + */ + char *resolved_path = malloc(src_size + (*path == '/' ? 0 : cwd_size) + 2); if (!resolved_path) return NULL; |