Hi Vincent,
On 2026-06-20T19:39:29+0200, Vincent Lefevre wrote:
> On 2026-06-18 11:28:00 +0800, Kevin J. McCarthy wrote:
> > In this case, I think the proposed patch is the best solution:
> >
> > diff --git a/rfc2047.c b/rfc2047.c
> > index d72ae997..2bdd8553 100644
> > --- a/rfc2047.c
> > +++ b/rfc2047.c
> > @@ -815,7 +815,7 @@ static size_t lwslen(const char *s, size_t n)
> > len = (size_t)(p - s);
> > break;
> > }
> > - if (strchr("\r\n", *(p-1))) /* LWS doesn't end with CRLF */
> > + if (len > 0 && strchr("\r\n", *(p-1))) /* LWS doesn't end with CRLF */
> > len = (size_t)0;
> > return len;
> > }
>
> "len = (size_t)0;" has a cast, but "len > 0" doesn't.
> This doesn't matter much, but this is not consistent.Comparison with a literal should not use casts. The few false-positive diagnostics that can happen are compiler bugs. See <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119011>. Let's not add more superfluous casts (but we don't need to remove the existing ones). Have a lovely night! Alex -- <https://www.alejandro-colomar.es>
signature.asc
Description: PGP signature
