On Mon, Sep 05, 2016 at 07:07:18PM -0500, Derek Martin wrote:
> On Mon, Sep 05, 2016 at 10:32:40AM -0500, Derek Martin wrote:
> > Is strfcpy() widely available?  
> 
> Ah, now I see that strfcpy() is a Mutt-specific macro that intends to
> make strncpy() safer.  I was actually thinking of strlcpy(), which is
> equivalent to Mutt's strfcpy(); but it does not matter.  ALL of these
> functions suffer from the same affliction: If dest is too small, they
> all silently lose data on copy.
> 
> There are approximately 360 such calls to strfcpy() in Mut's code; if
> any of these calls are used in such a way that data loss is sensitive,
> it could result in a security exploit.  It would require an audit.
> 
> Maybe there's an easier way to deal with that problem that's still
> reasonable:
> 
> #include <assert.h>
> 
> int safe_strncpy(char *dest, char *src, size_t size)
> {
>     return snprintf(dest, size, "%s", src);

Quick question, mutt has snprintf.c which implements snprintf and
vsnprintf. Now that mutt requires a C99 compiler, is this file (and
checks in configure) still needed?

Reply via email to