Commit d10c9b58e3940fc75fa5017eeb52111c2ff5ebf2

Stefan Sperling 2019-02-19T13:23:04

missing stat error check in read_meta_file()

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
diff --git a/lib/worktree.c b/lib/worktree.c
index 43324d9..f6e70aa 100644
--- a/lib/worktree.c
+++ b/lib/worktree.c
@@ -153,7 +153,10 @@ read_meta_file(char **content, const char *path_got, const char *name)
 		goto done;
 	}
 
-	stat(path, &sb);
+	if (lstat(path, &sb) != 0) {
+		err = got_error_from_errno();
+		goto done;
+	}
 	*content = calloc(1, sb.st_size);
 	if (*content == NULL) {
 		err = got_error_from_errno();