Commit e9dabdfbdb742547fc6c853c2626364177aa2b71

Stefan Sperling 2019-10-06T18:23:02

check for errors from fseek(3) in diff3.c's edscript()

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
diff --git a/lib/diff3.c b/lib/diff3.c
index d5408e8..47f5198 100644
--- a/lib/diff3.c
+++ b/lib/diff3.c
@@ -1055,7 +1055,9 @@ edscript(int n, struct diff3_state *d3s)
 			if (err)
 				return err;
 		}
-		(void)fseek(d3s->fp[2], (long)d3s->de[n].new.from, SEEK_SET);
+		if (fseek(d3s->fp[2], (long)d3s->de[n].new.from, SEEK_SET)
+		    == -1)
+			return got_error_from_errno("fseek");
 		k = d3s->de[n].new.to - d3s->de[n].new.from;
 		for (; k > 0; k-= j) {
 			j = k > BUFSIZ ? BUFSIZ : k;