From bd93b8d9becb01d21871b63e34c2e824c60b1e8c Mon Sep 17 00:00:00 2001 From: Jon Griffiths Date: Tue, 23 Feb 2016 02:15:41 -0500 Subject: credential-cache--daemon: disallow relative socket path Relative socket paths are dangerous since the user cannot generally control when the daemon starts (initially, after a timeout, kill or crash). Since the daemon creates but does not delete the socket directory, this could lead to spurious directory creation relative to the users cwd. Suggested-by: Jeff King Signed-off-by: Jon Griffiths Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- credential-cache--daemon.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'credential-cache--daemon.c') diff --git a/credential-cache--daemon.c b/credential-cache--daemon.c index 118d04f13..fe3779472 100644 --- a/credential-cache--daemon.c +++ b/credential-cache--daemon.c @@ -262,6 +262,9 @@ int main(int argc, const char **argv) if (!socket_path) usage_with_options(usage, options); + if (!is_absolute_path(socket_path)) + die("socket directory must be an absolute path"); + init_socket_directory(socket_path); register_tempfile(&socket_file, socket_path); -- cgit v1.2.1