Re: Fwd: report 3/3: latent unterminated buffer in imap_wordcasecmp()

Kurt Hackenberg <[email protected]> Fri, 19 Jun 2026 03:25:57 -0400
Newsgroups gmane.mail.mutt.devel
Message-ID <[email protected]>
On Fri, Jun 19, 2026 at 14:50 +0800, Kevin J. McCarthy wrote:

>Mutt uses its own ascii_* functions because the built-in ones are 
>problematic for some locales.  The isspace() has weird issues too...

Ah.

>We could change the retval of the function to true/false and use the 
>ascii_toupper() and IS_ASCII_WS() function in your loop above.  Or keep 
>the comparison and just do something like:
>
>  size_t a_len, b_len;
>
>  a_len = mutt_strlen(a);
>  b_len = b ? strcspn(b, " \t\n\v\f\r") : 0;
>  return ascii_strncasecmp(a, b, MAX(a_len, b_len));

Either should be OK; I don't care much. Both improve on what's there now.