git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] builtin/receive-pack: use constant-time comparison for HMAC value

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 22, 2020, 15:57 UTC
Message-ID
<xmqqo8rjjyxy.fsf@gitster.c.googlers.com>
In-Reply-To
<20200422102734.GA3063@szeder.dev>
Subject: receive-pack: compilation fix

We do not use C99 "for loop initial declaration" in our codebase (yet), but one snuck in.

Reported-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 builtin/receive-pack.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index 45e2dd2a65..66149777a0 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -505,7 +505,9 @@ static char *find_header(const char *msg, size_t len, const char *key,
 static int constant_memequal(const char *a, const char *b, size_t n)
 {
 	int res = 0;
-	for (size_t i = 0; i < n; i++)
+	size_t i;
+
+	for (i = 0; i < n; i++)
 		res |= a[i] ^ b[i];
 	return res;
 }
-- 
2.26.2-108-g048abe1751
Previous: SZEDER Gábor
Message 6 of 6 in “builtin/receive-pack: use constant-time comparison for HMAC value”
  1. builtin/receive-pack: use constant-time comparison for HMAC valuebrian m. carlson, Apr 9, 2020
  2. Junio C HamanoApr 10, 2020
  3. Junio C HamanoApr 10, 2020
  4. brian m. carlsonApr 10, 2020
  5. SZEDER GáborApr 22, 2020
  6. Junio C HamanoApr 22, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.