From: Brian Gernhardt <brian@gernhardtsoftware.com>
To: Git List <git@vger.kernel.org>
Cc: Junio C Hamano <gitster@pobox.com>
Subject: [PATCH] Receive-pack: include entire SHA1 in nonce
Date: Thu, 25 Sep 2014 11:02:20 -0400 [thread overview]
Message-ID: <1411657340-62950-1-git-send-email-brian@gernhardtsoftware.com> (raw)
clang gives the following warning:
builtin/receive-pack.c:327:35: error: sizeof on array function
parameter will return size of 'unsigned char *' instead of 'unsigned
char [20]' [-Werror,-Wsizeof-array-argument]
git_SHA1_Update(&ctx, out, sizeof(out));
^
builtin/receive-pack.c:292:37: note: declared here
static void hmac_sha1(unsigned char out[20],
^
---
I dislike changing sizeof to a magic constant, but clang informs me that
sizeof is doing the wrong thing. Perhaps there's an appropriate constant
#defined in the code somewhere?
builtin/receive-pack.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index aab3df7..92388e5 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -324,7 +324,7 @@ static void hmac_sha1(unsigned char out[20],
/* RFC 2104 2. (6) & (7) */
git_SHA1_Init(&ctx);
git_SHA1_Update(&ctx, k_opad, sizeof(k_opad));
- git_SHA1_Update(&ctx, out, sizeof(out));
+ git_SHA1_Update(&ctx, out, 20);
git_SHA1_Final(out, &ctx);
}
--
2.1.1.445.gb8dfbef.dirty
next reply other threads:[~2014-09-25 15:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-25 15:02 Brian Gernhardt [this message]
2014-09-25 16:23 ` [PATCH] Receive-pack: include entire SHA1 in nonce Junio C Hamano
2014-09-25 16:35 ` Junio C Hamano
2014-09-25 17:54 ` Junio C Hamano
2014-09-25 18:03 ` Brian Gernhardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1411657340-62950-1-git-send-email-brian@gernhardtsoftware.com \
--to=brian@gernhardtsoftware.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).