Skip to content

Commit

Permalink
imap-send: properly error out if imap.host is not set in config
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Gerrit Pape authored and Junio C Hamano committed Mar 26, 2008
1 parent 40ae887 commit 5b67b8e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions imap-send.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 )) {
Expand Down

0 comments on commit 5b67b8e

Please sign in to comment.