Re: Re: Corrupted "return address"

Brian Candler <[email protected]>
Newsgroups gmane.mail.sqwebmail
Message-ID <[email protected]>
On Tue, Apr 06, 2004 at 09:09:06AM +0100, sq sub wrote:
> I would be interested to see the proper fix. 

It's below. However I have to say I don't understand why generating
returnaddr before the fork is a problem; all that login_returnaddr does is
malloc a buffer and copy in the contents of AUTHADDR @ hostname

Explanations on a postcard please :-)

Regards,

Brian.


$ diff -uNr sqwebmail-4.0.2 sqwebmail-4.0.3
...
diff -uNr sqwebmail-4.0.2/sqwebmail/newmsg.c sqwebmail-4.0.3/sqwebmail/newmsg.c
--- sqwebmail-4.0.2/sqwebmail/newmsg.c	Sun Jan 25 05:38:50 2004
+++ sqwebmail-4.0.3/sqwebmail/newmsg.c	Mon Apr  5 23:47:48 2004
@@ -5,7 +5,7 @@
 
 
 /*
-** $Id: newmsg.c,v 1.51 2004/01/25 05:38:50 mrsam Exp $
+** $Id: newmsg.c,v 1.52 2004/04/05 22:47:48 mrsam Exp $
 */
 #include	"config.h"
 #include	"sqwebmail.h"
@@ -747,8 +747,6 @@
 		return (0);
 	}
 
-	returnaddr=login_returnaddr();
-
 	dsn= *cgi("dsn") != 0;
 
 	pid=fork();
@@ -792,9 +790,12 @@
 			putenv("DSN=");
 
 		if (fd == 0)
+		{
+			returnaddr=login_returnaddr();
 			execl(SENDITSH, "sendit.sh", returnaddr,
 				sqwebmail_mailboxid, NULL);
-
+		}
+			
 		fwrite(noexec, 1, sizeof(noexec)-1, stderr);
 		_exit(1);
 	}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.