<<< Date Index >>>     <<< Thread Index >>>

Re: hcache broken (slightly)



Hello,

> -  memcpy(d + *off, header, sizeof (HEADER));
> +
> +  /* copy the interesting bits we want, leave others 0 */
> +  memset (&tmp, 0, sizeof (HEADER));
> +  tmp.security = header->security; 
> +  tmp.mime = header->mime; 
> +  tmp.flagged = header->flagged; 
> +  tmp.old = header->old; 
> +  tmp.read = header->read; 
> +  tmp.expired = header->expired; 
> +  tmp.superseded = header->superseded; 
> +  tmp.replied = header->replied; 
> +  tmp.recip_valid = header->recip_valid; 
> +  tmp.zhours = header->zhours; 
> +  tmp.zminutes = header->zminutes; 
> +  tmp.zoccident = header->zoccident; 
> +  tmp.date_sent = header->date_sent; 
> +  tmp.received = header->received; 
> +  tmp.lines = header->lines; 
> +
> +  memcpy(d + *off, &tmp, sizeof (HEADER));
>    *off += sizeof (HEADER);

I don't like that at all. I am almost sure that you're goind to break
things like that. If you ignore some headers, please set them explicit
to zero. So that it is easy to see what is happening and find a bug if
one of the headers need to be set to a different value. Like:

        header->data = NULL;

        Thomas