Skip to content

Commit 6f5ef44

Browse files
Benabikgitster
authored andcommitted
receive-pack::hmac_sha1(): copy the entire SHA-1 hash out
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], ^ Signed-off-by: Brian Gernhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5732373 commit 6f5ef44

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

builtin/receive-pack.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ static int copy_to_sideband(int in, int out, void *arg)
288288

289289
#define HMAC_BLOCK_SIZE 64
290290

291-
static void hmac_sha1(unsigned char out[20],
291+
static void hmac_sha1(unsigned char *out,
292292
const char *key_in, size_t key_len,
293293
const char *text, size_t text_len)
294294
{
@@ -323,7 +323,7 @@ static void hmac_sha1(unsigned char out[20],
323323
/* RFC 2104 2. (6) & (7) */
324324
git_SHA1_Init(&ctx);
325325
git_SHA1_Update(&ctx, k_opad, sizeof(k_opad));
326-
git_SHA1_Update(&ctx, out, sizeof(out));
326+
git_SHA1_Update(&ctx, out, 20);
327327
git_SHA1_Final(out, &ctx);
328328
}
329329

0 commit comments

Comments
 (0)