git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Receive-pack: include entire SHA1 in nonce
@ 2014-09-25 15:02 Brian Gernhardt
  2014-09-25 16:23 ` Junio C Hamano
  2014-09-25 16:35 ` Junio C Hamano
  0 siblings, 2 replies; 5+ messages in thread
From: Brian Gernhardt @ 2014-09-25 15:02 UTC (permalink / raw)
  To: Git List; +Cc: Junio C Hamano

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-09-25 18:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-25 15:02 [PATCH] Receive-pack: include entire SHA1 in nonce Brian Gernhardt
2014-09-25 16:23 ` 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

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).