On Thu, Nov 17, 2016 at 05:24:25PM -0800, Kevin J. McCarthy wrote:
> On Thu, Nov 17, 2016 at 03:10:56PM -0800, Brendan Cully wrote:
> > diff -r 91b3449f426b -r 3c6d322912e3 init.c
> > --- a/init.c        Wed Nov 16 16:05:02 2016 -0800
> > +++ b/init.c        Thu Nov 17 15:07:14 2016 -0800
> > @@ -2901,11 +2901,11 @@
> >  
> >  static char* mutt_find_cfg (const char *home, const char *xdg_cfg_home)
> >  {
> > -  const char* names[] =
> > +  const char* names[][2] =
> >    {
> > -    "muttrc-" MUTT_VERSION,
> > -    "muttrc",
> > -    NULL,
> > +    { "muttrc", "-" MUTT_VERSION },
> > +    { "muttrc", "" },
> > +    { NULL, NULL },
> >    };
> >  
> >    const char* locations[][2] =
> > @@ -2925,12 +2925,12 @@
> >      if (!locations[i][0])
> >        continue;
> >  
> > -    for (j = 0; names[j]; j++)
> > +    for (j = 0; names[j][0]; j++)
> >      {
> >        char buffer[STRING];
> >  
> > -      snprintf (buffer, sizeof (buffer),
> > -                "%s/%s%s", locations[i][0], locations[i][1], names[j]);
> > +      snprintf (buffer, sizeof (buffer), "%s/%s%s%s",
> > +                locations[i][0], locations[i][1], names[j][0], 
> > names[j][1]);
> >        if (access (buffer, F_OK) == 0)
> >          return safe_strdup(buffer);
> >      }
> 
> Sorry, I think I turned my brain off during the backout, and forgot to
> turn it back on when I made this change.
> 
> I have no idea what I thought I was doing here, but I will put
> mutt_find_cfg() back the way it was, and quit for the night!

Right, if "MUTT_VERSION" contains a '%' or '\0', it might be an issue
but considering the history of VERSION, I don't think this is a real
issue. Anyway, better safe than sorry.

I think the strfcpy in compose.c and status.c were okay, as it doesn't
involve string substitution.

Thanks for making the fix.

-- 
Damien

Reply via email to