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

[PATCH] mailinfo: fix passing wrong address to git_mailinfo_config

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
Nov 1, 2015, 14:30 UTC
Message-ID
<1446388230-27966-1-git-send-email-pclouds@gmail.com>

git_mailinfo_config() expects "struct mailinfo *". But in setup_mailinfo(), "mi" is already "struct mailinfo *". &mi would make it "struct mailinfo **" and git_mailinfo_config() would damage some other memory when it assigns some value to mi->use_scissors.

This is caught by t4150.20. git_mailinfo_config() breaks mi->name.alloc and makes strbuf_release() in clear_mailinfo() attempt to free strbuf_slopbuf.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 mailinfo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mailinfo.c b/mailinfo.c
index e157ca6..f289941 100644
--- a/mailinfo.c
+++ b/mailinfo.c
@@ -1009,7 +1009,7 @@ void setup_mailinfo(struct mailinfo *mi)
 	mi->header_stage = 1;
 	mi->use_inbody_headers = 1;
 	mi->content_top = mi->content;
-	git_config(git_mailinfo_config, &mi);
+	git_config(git_mailinfo_config, mi);
 }
 
 void clear_mailinfo(struct mailinfo *mi)
-- 
2.2.0.513.g477eb31
Next: Junio C Hamano
Message 1 of 2 in “mailinfo: fix passing wrong address to git_mailinfo_config”
  1. mailinfo: fix passing wrong address to git_mailinfo_configNguyễn Thái Ngọc Duy, Nov 1, 2015
  2. Junio C HamanoNov 1, 2015

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.