reopen 405704 > Changes: > up-imapproxy (1.2.4-8) unstable; urgency=high > . > * Fixed crash on startup when IMAP server is not available (Closes: > #405704)
The patch provided by Kees Cook was correct, but you only applied half
of it. Let's have a look at the code:
for ( ai = ISD.ai; ; ai = ai->ai_next ) {
[... boring stuff ...]
else
{
break; /* Success */
}
if (!(ai=ai->ai_next)) {
syslog(LOG_ERR, "%s: connect() failed to all addresses.", fn);
sleep( 15 ); /* IMAP server may not be started yet. */
ai = ISD.ai;
}
}
What now happens is that if the connect to the first address failed, you
get the next address ("ai=ai->ai_next"), check that it is not NULL (if
!) and then hop to the beginning of the loop again, where you will see
that "ai = ai->ai_next" happens again. Not good.
So, you either need to do if (! ai->ai_next), or use for (ai=ISD.ai;;)
{, or do something like this:
ai = ISD.ai
while (ai) {
[...]
if (!(ai=ai->ai_next)) {
...
That last proposal looks best to me, but that's because I don't know if
ISD.ai can be assumed to be != NULL or not.
Anyway, fix it.
Marc
--
Fachbegriffe der Informatik - Einfach erklärt
286: Googlehupf
Abstand zwischen zwei Suchergebnissen.
pgpuRndhUWZgn.pgp
Description: PGP signature

