提交 b54cb795 编写于 作者: M Michael Haggerty 提交者: Junio C Hamano

resolve_ref(): use prefixcmp()

Terminate the link content string one step earlier, allowing
prefixcmp() to be used instead of the less clear memcmp().
Signed-off-by: NMichael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 7bb2bf8e
......@@ -520,8 +520,8 @@ const char *resolve_ref(const char *ref, unsigned char *sha1, int reading, int *
len = readlink(path, buffer, sizeof(buffer)-1);
if (len < 0)
return NULL;
if (len >= 5 && !memcmp("refs/", buffer, 5)) {
buffer[len] = 0;
buffer[len] = 0;
if (!prefixcmp(buffer, "refs/")) {
strcpy(ref_buffer, buffer);
ref = ref_buffer;
if (flag)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册