I think that Gilles found and fixed the problem correctly. The change where he increased the size of the memory allocated to match the length of the filename string is the key. Without that change, the byte just past the end of the memory allocated doesn't really belong to the program, and so could be written over by another process, or even by other code in the same process. This is why the problem shows itself so randomly and why the filename's ending character in the error log report differs from report to report. The other change, reducing the size of the malloc to match the filename size, should not help in solving the problem, although it might mask it; but it is more correct to only allocate the memory really required. In fact, memory allocations really happen in blocks with a minimum size to them, which increases the randomness of the symptoms; if a short malloc ended up allocating just the amount of memory requested, and the amount requested was too small by one byte, then that final byte would be more likely to be overwritten; but if the memory manager allocated a chunk that was really longer than absolutely needed anyway, then overwriting the memory *might* make no difference. I am a C/C++ programmer, but that doesn't mean I swear I'm right about this; it's been a long while since I wrote code for Unix and so the particulars of Linux and GNU gcc's memory manager are unfamiliar to me. I will say I'm mighty impressed that self-professed "non-C programmers" (or should that be "C non-programmers?") came up with this solution.
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Rick Matthews Sent: Wednesday, August 28, 2002 9:22 AM To: Gilles CHAUVIN Cc: Squidguard Mailing List Subject: RE: [BUG] "No such file or directory" during updates, solved!? > -----Original Message----- > From: Gilles CHAUVIN > Sent: Wednesday, August 28, 2002 3:03 AM > > Ok, so... I'll try to explain this (with my wonderful english ;). I didn't know that english isn't your primary language until I read that comment. Your english is excellent! > Looking at the ML archives gives at least two other posts that talk > about this problem (that's the two posts I can remember talking about > this, maybe there are others): > http://marc.theaimsgroup.com/?l=squidguard&m=102008640828326&w=2 > http://marc.theaimsgroup.com/?l=squidguard&m=102636248825888&w=2
smime.p7s
Description: application/pkcs7-signature
