Commit 19332e6de6ff3f51e60c6e32716235833b2c6085

Stefan Sperling 2019-05-13T11:04:22

avoid undefined behaviour (comparison with string literal)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
diff --git a/lib/worktree.c b/lib/worktree.c
index 3f36aa4..b6a44c4 100644
--- a/lib/worktree.c
+++ b/lib/worktree.c
@@ -991,7 +991,8 @@ get_modified_file_content_status(unsigned char *status, FILE *f)
 		}
 
 		if (strncmp(line, markers[i], strlen(markers[i])) == 0) {
-			if (markers[i] == GOT_DIFF_CONFLICT_MARKER_END)
+			if (strcmp(markers[i], GOT_DIFF_CONFLICT_MARKER_END)
+			    == 0)
 				*status = GOT_STATUS_CONFLICT;
 			else
 				i++;