Commit Diff


commit - e34d12854902b472e38f40dbc4e1e44acf093240
commit + 9b7f22a6148eb14af6e59de120bb5b1dd0e05469
blob - 869bad5bf5837b83c807d8d0fe3333fbcaef2804
blob + ef8285e2c0dea56c703592e647a3268f64478a82
--- gotd/gotd.c
+++ gotd/gotd.c
@@ -2250,8 +2250,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");
@@ -2305,8 +2306,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;
 				}