mbexamine and block size cache files

John Capo jc at irbs.com
Wed Aug 20 16:20:16 EDT 2008


Quoting Wesley Craig (wes at umich.edu):
> On 20 Aug 2008, at 09:56, John Capo wrote:
> >That does work on FreeBSD 6.3.
> 
> If many entreis are not NULL terminated, perhaps all of the string  
> formats should be %.*s with a specified length, then.  Are you  
> willing to submit a tested patch?

Looking closer at the problem, NULL terminated strings are not by
design.  Each entry is padded to a 4 byte boundary and a NULL will
be in the cache file if the entry length is not a 4 byte multiple.
If the entry is a 4 byte multiple, the high order byte of the next
entry length will be 0 terminating the string if there is a next
entry and if the next entry length is <= 0x00FFFFFF.

So, anything that uses strings from the cache file must use the
length and not depend on NULL terminated strings.

I will patch and test mbexamine.

John Capo
Tuffmail.com



More information about the Cyrus-devel mailing list