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

[PATCH] imap-send: properly error out if imap.host is not set in config

From
Gerrit Pape <pape@smarden.org>
Date
Mar 26, 2008, 18:05 UTC
Message-ID
<20080326180517.23968.qmail@945917b39a7083.315fe32.mid.smarden.org>

If no imap host is specified in the git config, git imap-send used to try to lookup a null pointer through gethostbyname(), causing a segfault. Since setting the imap.host variable is mandatory, imap-send now properly fails with an explanatory error message.

The problem has been reported by picca through
 http://bugs.debian.org/472632
Signed-off-by: Gerrit Pape <pape@smarden.org>
---
 imap-send.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/imap-send.c b/imap-send.c
index 10cce15..04afbc4 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -1302,6 +1302,10 @@ main(int argc, char **argv)
 		fprintf( stderr, "no imap store specified\n" );
 		return 1;
 	}
+	if (!server.host) {
+		fprintf( stderr, "no imap host specified\n" );
+		return 1;
+	}
 
 	/* read the messages */
 	if (!read_message( stdin, &all_msgs )) {
-- 
1.5.4.4
Message 1 of 1 in “imap-send: properly error out if imap.host is not set in config”
  1. imap-send: properly error out if imap.host is not set in configGerrit Pape, Mar 26, 2008

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.