Commit bbfe163a911251028ccdcd91b7af7d9fb71919eb

Stefan Sperling 2017-11-05T14:22:50

clear sha1 digest before parsing

1
2
3
4
5
6
7
8
9
10
11
12
diff --git a/lib/refs.c b/lib/refs.c
index f409652..c520fc2 100644
--- a/lib/refs.c
+++ b/lib/refs.c
@@ -59,6 +59,7 @@ parse_sha1_digest(uint8_t *digest, const char *line)
 	uint8_t b;
 	int i, n;
 
+	memset(digest, 0, SHA1_DIGEST_LENGTH);
 	for (i = 0; i < SHA1_DIGEST_LENGTH; i++) {
 		n = sscanf(line, "%hhx", &b);
 		if (n == 1)