Re: mutt/2153: uninitialized variable flags in hdrline.c
The following reply was made to PR mutt/2153; it has been noted by GNATS.
From: David Champion <dgc@xxxxxxxxxxxx>
To: bug-any@xxxxxxxxxxxxx
Cc:
Subject: Re: mutt/2153: uninitialized variable flags in hdrline.c
Date: Tue, 10 Jan 2006 11:48:16 -0600
* On 2005.12.16, in <E1EnDbk-0006RL-9y@xxxxxxxxxxxxxxxxxxxx>,
* "vincent@xxxxxxxxxx" <vincent@xxxxxxxxxx> wrote:
>
> case 'X':
> {
> int count, flags;
>
> if (hdr->content->parts)
> count = mutt_count_body_parts(hdr, flags);
> else
> {
> mutt_parse_mime_message(ctx, hdr);
> count = mutt_count_body_parts(hdr, flags);
> mutt_free_body(&hdr->content->parts);
> }
>
> The flags value is passed to mutt_count_body_parts though it has not
> been initialized. I don't know if it is really used or not. Anyway
> this is incorrect (undefined behavior according to the ISO C standard)
> and one never knows what the compiler will do in such a case (e.g. it
> could possibly detect it and generate a trap for security reasons).
Flags used to be used. It looks like that code was (rightly) removed
when $attach_recurse taken out for CVS integration, so it's no longer
needed. The way things stand now, it would be safe and probably best to
replace flags with 0 and eliminate the auto declaration.
Thanks.
--
-D. dgc@xxxxxxxxxxxx NSIT University of Chicago