When giving relative paths to `relative_path` to compute a relative path
from one directory to another, this may fail in `relative_path`.
Make sure both arguments to `relative_path` are always absolute.
Signed-off-by: Stefan Beller
---
builtin/submodule--helper.c | 28 ++-
Stefan Beller writes:
> + char *sm_gitdir_rel, *p, *path = NULL;
> + const char *sm_gitdir;
> struct strbuf rel_path = STRBUF_INIT;
> struct strbuf sb = STRBUF_INIT;
>
> @@ -198,7 +199,14 @@ static int module_clone(int argc, const char **argv,
> const char *prefix)
>
Junio C Hamano writes:
> By the way, this line is the last use of sm_gitdir_rel before it
> gets freed. I wonder
>
> sm_gitdir = absolute_path(sb.buf);
>
> would be sufficient. We can lose the variable, and free() on it at
> the end of this function, and an extra allocation if we can do s
On Fri, Apr 1, 2016 at 3:30 PM, Junio C Hamano wrote:
> Subject: [PATCH] submodule--helper: do not borrow absolute_path() result for
> too long
>
> absolute_path() is designed to allow its callers to take a brief
> peek of the result (typically, to be fed to functions like
> strbuf_add() and rela
Junio C Hamano writes:
> From: Junio C Hamano
> Date: Fri, 1 Apr 2016 12:23:16 -0700
> Subject: [PATCH] submodule--helper: do not borrow absolute_path() result for
> too long
>
> absolute_path() is designed to allow its callers to take a brief
> peek of the result (typically, to be fed to funct
5 matches
Mail list logo