Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2021-12-18 12:47:03 +0300
committerJunio C Hamano <gitster@pobox.com>2021-12-20 23:43:18 +0300
commit999bba3e0bbb2e81a3e1b2bdb5846479d1e663ad (patch)
treef360d95ec3c0fae8e109cf892a228938989f4e7c /daemon.c
parente9d7761bb94f20acc98824275e317fa82436c25d (diff)
daemon: plug memory leak on overlong path
Release the strbuf containing the interpolated path after copying it to a stack buffer and before erroring out if it's too long. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'daemon.c')
-rw-r--r--daemon.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/daemon.c b/daemon.c
index b1fcbe0d6f..99ae30fedb 100644
--- a/daemon.c
+++ b/daemon.c
@@ -232,13 +232,13 @@ static const char *path_ok(const char *directory, struct hostinfo *hi)
rlen = strlcpy(interp_path, expanded_path.buf,
sizeof(interp_path));
+ strbuf_release(&expanded_path);
if (rlen >= sizeof(interp_path)) {
logerror("interpolated path too large: %s",
interp_path);
return NULL;
}
- strbuf_release(&expanded_path);
loginfo("Interpolated dir '%s'", interp_path);
dir = interp_path;