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

[PATCH 2/2] imap-send: fix CRAM-MD5 response calculation

From
Kazuki Yamaguchi <k@rhe.jp>
Date
Apr 8, 2016, 14:02 UTC
Message-ID
<20160408140229.GC13469@chikuwa.rhe.jp>
In-Reply-To
<cover.1460122532.git.k@rhe.jp>

Remove extra + 1 from resp_len, the length of the byte sequence to be Base64 encoded and passed to the server as the response. Or the response incorrectly contains an extra \0.

Signed-off-by: Kazuki Yamaguchi <k@rhe.jp>
---
 imap-send.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/imap-send.c b/imap-send.c
index 30979f0c63cc..407e46bc8c0e 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -890,7 +890,7 @@ static char *cram(const char *challenge_64, const char *user, const char *pass)
 
 	/* response: "<user> <digest in hex>" */
 	response = xstrfmt("%s %s", user, hex);
-	resp_len = strlen(response) + 1;
+	resp_len = strlen(response);
 
 	response_64 = xmallocz(ENCODED_SIZE(resp_len));
 	encoded_len = EVP_EncodeBlock((unsigned char *)response_64,
-- 
2.8.1.104.g07d5700.dirty
Previous: Junio C Hamano
Message 3 of 3 in “imap-send: check for NOLOGIN capability only when using LOGIN command”
  1. 1/2 imap-send: check for NOLOGIN capability only when using LOGIN commandKazuki Yamaguchi, Apr 8, 2016
  2. Junio C HamanoApr 8, 2016
  3. 2/2 imap-send: fix CRAM-MD5 response calculationKazuki Yamaguchi, Apr 8, 2016

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.