diff options
author | Jonathan Nieder <jrnieder@gmail.com> | 2010-10-02 03:36:52 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-10-03 16:50:54 -0700 |
commit | 06f3549d7146179c5cafe8f76e8fcbc064eba2f7 (patch) | |
tree | c8516c89ed7f5732a15c914fdcfed1e0ae651d12 /block-sha1/sha1.c | |
parent | environment.c: remove unused variable (diff) | |
download | tgif-06f3549d7146179c5cafe8f76e8fcbc064eba2f7.tar.xz |
setup: make sure git dir path is in a permanent buffer
If setup_git_env() is run before the usual repository discovery
sequence and .git is a file with the text
gitdir: <path>
(with <path> any string) then the in-core git_dir variable is set to
the result of converting <path> to an absolute path using
make_absolute_path().
Unfortunately make_absolute_path() returns its result in a static
buffer that is overwritten by later calls. Such a call could cause
later accesses to git_dir (from git_pathdup(), for example) to read
the wrong path, leaving git very confused.
It is not obvious whether any existing code in git will trigger the
problem, but in any case, it is worth a few dozen bytes to copy the
return value from make_absolute_path() for some added peace of mind.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'block-sha1/sha1.c')
0 files changed, 0 insertions, 0 deletions