Commit Diff


commit - 1487ee74528d56ab29c4bda3f1812fe857abeb18
commit + fe6a8988670d1e54478187f93e22a1980f5926e4
blob - 12a7eb1e6d2aa691a1f8da94499d3605098ff532
blob + ba1640587b15adb6425a20a5faa6d0a9f8990ce4
--- gotd/gotd.c
+++ gotd/gotd.c
@@ -2249,8 +2249,9 @@ start_repo_child(struct gotd_client *client, enum gotd
 		fatalx("repository name too long: %s", repo->name);
 	log_debug("starting %s for repository %s",
 	    proc->type == PROC_REPO_READ ? "reader" : "writer", repo->name);
-	if (realpath(repo->path, proc->repo_path) == NULL)
-		return got_error_from_errno2("realpath", repo->path);
+	if (strlcpy(proc->repo_path, repo->path, sizeof(proc->repo_path)) >=
+	    sizeof(proc->repo_path))
+		fatalx("repository path too long: %s", repo->path);
 	if (socketpair(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK,
 	    PF_UNSPEC, proc->pipe) == -1)
 		fatal("socketpair");
@@ -2304,8 +2305,9 @@ start_auth_child(struct gotd_client *client, int requi
 		fatalx("repository name too long: %s", repo->name);
 	log_debug("starting auth for uid %d repository %s",
 	    client->euid, repo->name);
-	if (realpath(repo->path, proc->repo_path) == NULL)
-		return got_error_from_errno2("realpath", repo->path);
+	if (strlcpy(proc->repo_path, repo->path, sizeof(proc->repo_path)) >=
+	    sizeof(proc->repo_path))
+		fatalx("repository path too long: %s", repo->path);
 	if (socketpair(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK,
 	    PF_UNSPEC, proc->pipe) == -1)
 		fatal("socketpair");
blob - a29a7a44f821516812229082c0eb453b05172017
blob + 9be73f985cd4b495f70ba089cee603ee8afc861d
--- gotd/parse.y
+++ gotd/parse.y
@@ -274,10 +274,8 @@ repoopts1	: PATH STRING {
 					free($2);
 					YYERROR;
 				}
-				if (strlcpy(new_repo->path, $2,
-				    sizeof(new_repo->path)) >=
-				    sizeof(new_repo->path)) {
-					yyerror("%s: path truncated", __func__);
+				if (realpath($2, new_repo->path) == NULL) {
+					yyerror("realpath %s: %s", $2, strerror(errno));
 					free($2);
 					YYERROR;
 				}