@matheusbsbs / matheus-bagliano / commits / 5b67b8e2d4
Fork 0

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

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> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Gerrit Pape committed Mar 26, 2008 at 18:05 UTC 5b67b8e2d4ed8a152694f4555549fcde5dae77f5
1 file changed +4
imap-send.c
+4
@@ -1302,6 +1302,10 @@ main(int argc, char **argv)
1302 fprintf( stderr, "no imap store specified\n" );
1303 return 1;
1304 }
1305 + if (!server.host) {
1306 + fprintf( stderr, "no imap host specified\n" );
1307 + return 1;
1308 + }
1309
1310 /* read the messages */
1311 if (!read_message( stdin, &all_msgs )) {