Commit 60619907281df67dd34e257a01b78a876f168397

Stefan Sperling 2018-12-27T19:37:53

fix check for NUL byte in read_fileindex_path()

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/lib/fileindex.c b/lib/fileindex.c
index 0eda1d0..7752302 100644
--- a/lib/fileindex.c
+++ b/lib/fileindex.c
@@ -355,7 +355,7 @@ read_fileindex_path(char **path, SHA1_CTX *ctx, FILE *infile)
 		SHA1Update(ctx, buf, sizeof(buf));
 		memcpy(*path + len, buf, sizeof(buf));
 		len += sizeof(buf);
-	} while (strchr(buf, '\0') == NULL);
+	} while (memchr(buf, '\0', sizeof(buf)) == NULL);
 
 	if (err) {
 		free(*path);