mlmmj

changeset d0bf2135ab34

Check the server gives a reply before reading it to avoid segfaulting
author Ben Schmidt
date Fri, 12 Nov 2010 02:27:50 +1100
parents 62f9b36df5a5
children de31a9e15c5b
files ChangeLog src/checkwait_smtpreply.c
diffstat 2 files changed, 7 insertions(+), 0 deletions(-) [+]
line diff
     1.1 --- a/ChangeLog	Fri Nov 12 02:26:49 2010 +1100
     1.2 +++ b/ChangeLog	Fri Nov 12 02:27:50 2010 +1100
     1.3 @@ -1,3 +1,4 @@
     1.4 + o Check the relayhost gives a reply before reading it to avoid a crash
     1.5   o Avoid checking addresses multiple times for notmetoo and make it work even
     1.6     when delivering messages individually
     1.7   o Fixed small memory leaks when SMTP errors occur
     2.1 --- a/src/checkwait_smtpreply.c	Fri Nov 12 02:26:49 2010 +1100
     2.2 +++ b/src/checkwait_smtpreply.c	Fri Nov 12 02:27:50 2010 +1100
     2.3 @@ -36,6 +36,12 @@
     2.4  	char *smtpreply;
     2.5  
     2.6  	smtpreply = mygetline(sockfd);
     2.7 +	if(smtpreply == NULL) {
     2.8 +		/* This will never be a valid SMTP response so will always be returned,
     2.9 +		 * but is more descriptive than an empty string. */
    2.10 +		smtpreply = mystrdup("none / error / closed connection");
    2.11 +	}
    2.12 +
    2.13  #if 0
    2.14  	printf("replytype = [%d], smtpreply = [%s]\n", replytype, smtpreply);
    2.15  	fprintf(stderr, "%s", smtpreply);