Tuomas Silen writes:

Hi,

There seems to be a bug in couriertls (~every version of courier-imap) that causes it to segmentation fault if there are files with no dots in the certificate directory (peer_cert_dir). Openssl likes to put files like Makefile
there for some strange reason.

Problem is at libcourierctl.c:496:
495:   p=strrchr(de->d_name, '.');
496:   if (!p[0] || !p[1])
497:       continue;
498:   while (*++p)

If there's no dot in the filename, there will be no p[0] nor p[1] and
the program will segmentation fault.

I guess a solution might be to just change
  if (!p[0] || !p[1])
        continue;
to
  if (!p) continue;

IMHO the test was also meant to check at least one char in the extension.

--- courier-0.53.1.20060318.original/tcpd/libcouriertls.c       2006-01-28 
04:35:00.000000000 +0100
+++ courier-0.53.1.20060318/tcpd/libcouriertls.c        2006-04-14 
09:32:33.513180000 +0200
@@ -493,7 +493,7 @@
                                FILE *fp;
 
                                p=strrchr(de->d_name, '.');
-                               if (!p[0] || !p[1])
+                               if (!p || !p[1])
                                        continue;
                                while (*++p)
                                {

Reply via email to