[Raw Msg Headers][Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

smtp TA's SIGSEGV in getmxrr()



20001112 CVS and 2.99.54 smtp sometimes get SIGSEGV
on FreeBSD/OpenBSD systems. I traced that to happen
in getmxrr-test as well. The conditions look simple:
just have more than one A record for some particular MX.
For example getmxrr-test _always_ drops core if called as
./getmxrr-test aol.com
The same code does not exhibit this problem on at least one Linux.
smtp gets SEGV when it calls CISTREQ with 1st arg == null 
in the following line around #610 at transports/smtp/getmxrr.c  

   if (CISTREQ(mx[i].ai->ai_canonname, myhostname) ||
     matchmyaddresses(mx[i].ai) == 1) { 
 
where i is the next after actual number of MXes (the first "expanded
in it's own MX" A record).

getaddrinfo() in *BSD returns null canonname in that cases.

Changing that fragment to the following helps.

   if (mx[i].ai->ai_canonname && (CISTREQ(mx[i].ai->ai_canonname, myhostname) ||
     matchmyaddresses(mx[i].ai) == 1)) {

Now getmxrr-test don't crashes and mail to aol.com actually delivers.