Re: PATCH: Fix segfault with multiple bind addresses
Simon Horman <[email protected]>
| Newsgroups | gmane.mail.perdition.user |
|---|---|
| Message-ID | <[email protected]> |
On Mon, Aug 02, 2010 at 10:34:22AM +0900, Simon Horman wrote: > On Mon, Aug 02, 2010 at 12:46:37AM +0200, John Feuerstein wrote: > > Hi, > > > > I've encountered a segfault using the latest perdition tip when using > > multiple addresses with the bind_address option. Perdition works fine > > when using only a single address to bind to: > > > > > > Single address: > > > > > $ ./perdition -P IMAP4 --debug --no_daemon -u perdition --pid_file /var/run/perdition/imap4.pid --bind_address 127.0.0.1 > > > > > > # ... nothing (works fine) > > Hi John, > > thanks for bringing that to my attention. Yes, I see the segmentation fault too. Hi John, could you see if the following patch resolves the problem? From: Simon Horman <[email protected]> Allocate enough space for fromv This manifests as a crash-bug on start-up in the case where more than one address is supplied to the bind_address configuration option. Reported-by: John Feuerstein <[email protected]> Signed-off-by: Simon Horman <[email protected]> diff -r aeff92473a55 perdition/perdition.c --- a/perdition/perdition.c Sat Jul 31 14:23:46 2010 +0900 +++ b/perdition/perdition.c Mon Aug 02 22:35:26 2010 +0900 @@ -579,7 +579,7 @@ else nfrom = 1; - fromv = malloc(((nfrom * 2) + 1)); + fromv = malloc(sizeof(*fromv) * ((nfrom * 2) + 1)); if (!fromv) { VANESSA_LOGGER_DEBUG_ERRNO("malloc fromv"); VANESSA_LOGGER_ERR("Fatal error allocating memory. Exiting."); ______________________________________________ Perdition-users mailing list [email protected] http://lists.vergenet.net/listinfo/perdition-users