On Thu, May 23, 2002 at 01:53:00PM +0200, Benjamin Lorson wrote:
> Hi,
> 
> I managed to compile qmail-ldap (20020501a) with the ldap-control patch
> (20020503).
> Really great piece of software, good work!
> 
> 
> However, I have a small problem with qmail-quotawarn. It crashes with a
> segfault every time it is executed.
> 
> The problem seems to be line 189 (in write_maildir):
>         str_copy(fnnewtph,fntmptph);
> 
> Unfortunately I don't speak enough C to even understand what it is doing,
> so it is unlikely that I'm able to help myself :)
> 
You could try the attached patch.
I guess, that the original string size is to small.

-- 
:wq Claudio
Index: qmail-quotawarn.c
===================================================================
RCS file: /home/cvs-qmail-ldap/CVS/qmail-ldap/qmail-quotawarn.c,v
retrieving revision 1.4
diff -u -r1.4 qmail-quotawarn.c
--- qmail-quotawarn.c   2 May 2002 14:05:41 -0000       1.4
+++ qmail-quotawarn.c   23 May 2002 12:37:40 -0000
@@ -122,8 +122,8 @@
 
 }
 
-char fntmptph[30];
-char fnnewtph[30];
+char fntmptph[80 + FMT_ULONG * 2];
+char fnnewtph[83 + FMT_ULONG * 3];
 void tryunlinktmp() { unlink(fntmptph); }
 void sigalrm()
    { tryunlinktmp(); strerr_die1x(111,"Timeout on quota-warning delivery. (LDAP-ERR 
#5.2.9)"); }
@@ -222,7 +222,14 @@
 
    if (substdio_flush(&ssout) == -1) goto fail;
    if (fsync(fd) == -1) goto fail;
+   if (fstat(fd, &st) == -1) goto fail;
    if (close(fd) == -1) goto fail; /* NFS dorks */
+
+   s = fnnewtph;
+   while( *s ) s++;
+   s += fmt_str(s,",S=");
+   s += fmt_ulong(s,(unsigned long) st.st_size);
+   *s++ = 0;
 
    if (link(fntmptph,fnnewtph) == -1) /* if error_exist unlink and exit(0), strange 
things can happen */
       if ( errno != error_exist) goto fail;

Reply via email to