Commit 8fa2f09641633918aea9c50370f672cbc1c37686

Stefan Sperling 2019-03-11T16:28:11

fix off-by-one in fwrite() check in got_ref_write()

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/lib/reference.c b/lib/reference.c
index fead5a1..09760eb 100644
--- a/lib/reference.c
+++ b/lib/reference.c
@@ -744,7 +744,7 @@ got_ref_write(struct got_reference *ref, struct got_repository *repo)
 			goto done;
 		}
 		n = fprintf(f, "%s\n", hex);
-		if (n != sizeof(hex) + 1) {
+		if (n != sizeof(hex)) {
 			err = got_ferror(f, GOT_ERR_IO);
 			goto done;
 		}