Commit 56d815a9328f873fd6818ac625999d06a8752a45

Stefan Sperling 2020-07-23T14:21:31

We must null-terminate the result of readlink(3) in merge_symlink().

1
2
3
4
5
6
7
8
9
10
11
12
diff --git a/lib/worktree.c b/lib/worktree.c
index 18f9d88..f6e9f09 100644
--- a/lib/worktree.c
+++ b/lib/worktree.c
@@ -947,6 +947,7 @@ merge_symlink(struct got_worktree *worktree,
 		    ondisk_path);
 		goto done;
 	}
+	ondisk_target[ondisk_len] = '\0';
 
 	if (blob_orig) {
 		err = got_object_blob_read_to_str(&ancestor_target, blob_orig);