Commit 4f18c4000896c6ade7e7bd662d05f75686d338b2

Christian Weisgerber 2021-10-16T15:01:42

fix another segfault in edscript() Same problem as fixed in 90de04bc7f1b85b9c491bcd124f6178fad005de1. ok stsp

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/lib/diff3.c b/lib/diff3.c
index 9b91858..bedddef 100644
--- a/lib/diff3.c
+++ b/lib/diff3.c
@@ -1048,7 +1048,7 @@ edscript(int n, struct diff3_state *d3s)
 				goto done;
 		} else {
 			err = diff_output(d3s->diffbuf, "%s%s\n.\n",
-			    line[linelen] == '\n' ? ":" : "",
+			    linelen > 0 && line[linelen] == '\n' ? ":" : "",
 			    d3s->f3mark);
 			if (err)
 				goto done;