Hello,

We've been experiencing quota warnings being delivered when a mailbox 
is way below quota.  I think i have the problem tracked down to using 
safecat for message delivery under certain circumstances - safecat 
doesn't append the message size to the filename and that seems to be 
causing problems with the get_file_size function.

Picking through the code, it seems the get_file_size function assumes 
the message size will be appended to the filename and never actually 
reaches the code that does a stat() on the filename.  In the case of 
a safecat created file, the "s += 3" within the while() loop in 
get_file_size runs past the end of the filename buffer so it 
calculates the size based on "random" memory and sometimes comes up 
with a number that's way too big.

As a fix, i put an additional test into get_file_size to double-check 
that the filesize is actually appended and breaks out of the while() 
so the filename can be stat()'ed if there's no filesize.  The patch 
below (against 0901) implements this fix.

Can somebody please take a look at this patch and let me know if i'm 
asking for trouble or if it will fix the problem?


        -neil


--- maildir++.c.orig    Fri Oct 11 00:15:18 2002
+++ maildir++.c Fri Oct 11 00:18:37 2002
@@ -524,6 +524,7 @@
                if ( *s != ',' || s[1] != 'S' || s[2] != '=' ) {
                        s++;
                } else {
+                       if (s[2] != '=') break;
                        s += 3;
                        st->st_size = 0;
                        while ( *s >= '0' && *s <= '9' )





Reply via email to