Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
builtin/get-tar-commit-id: make hash size independent
author
brian m. carlson
<sandals@crustytoothpaste.net>
Tue, 19 Feb 2019 00:05:19 +0000
(
00:05
+0000)
committer
Junio C Hamano
<gitster@pobox.com>
Mon, 1 Apr 2019 02:57:39 +0000
(11:57 +0900)
To make this code independent of the hash size, verify that the length
of the comment is equal to that of any supported hash algorithm.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/get-tar-commit-id.c
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(parent:
3548726
)
diff --git
a/builtin/get-tar-commit-id.c
b/builtin/get-tar-commit-id.c
index 312e44ed05fb1604a37dbfdab7a1f81a19b75ba5..491af9202dc937339db83980e2bf96de6ff81646 100644
(file)
--- a/
builtin/get-tar-commit-id.c
+++ b/
builtin/get-tar-commit-id.c
@@
-41,7
+41,8
@@
int cmd_get_tar_commit_id(int argc, const char **argv, const char *prefix)
if (!skip_prefix(end, " comment=", &comment))
return 1;
len -= comment - content;
- if (len != GIT_SHA1_HEXSZ + 1)
+ if (len < 1 || !(len % 2) ||
+ hash_algo_by_length((len - 1) / 2) == GIT_HASH_UNKNOWN)
return 1;
if (write_in_full(1, comment, len) < 0)