base64 functions with SASL in INN

Russ Allbery rra at stanford.edu
Fri Jun 19 21:26:15 UTC 2009


Julien ÉLIE <julien at trigofacile.com> writes:

> Then I see we have another bug here in imap_connection:
>
>      /* convert to base64 */
>      inbase64 = xmalloc(outlen*2+10);
>
>      saslresult = sasl_encode64(out, outlen,
>            inbase64, outlen*2+10,
>            (unsigned *) &inbase64len);
>
>      /* add an endline */
>      strlcpy(inbase64 + inbase64len, "\r\n", outlen * 2 + 10);
>
>      /* send to server */
>      result = WriteToWire_lmtpstr(cxn,inbase64, inbase64len+2);
>
> strlcpy may write out of where it should...

Yup, good catch.

> The right thing is malloc "+10", out "+8" and copy "+10 - inbase64len".

Yes.

> By the way, imap_connection does not seem easy to maintain...  (Well,
> like innfeed!)  I have never tested it...

It needs to be merged into the rest of innfeed so that it's
maintainable, since right now it's largely a copy of other innfeed code
and is indeed very difficult to maintain.  Lots of work, though.

-- 
Russ Allbery (rra at stanford.edu)             <http://www.eyrie.org/~eagle/>

    Please send questions to the list rather than mailing me directly.
     <http://www.eyrie.org/~eagle/faqs/questions.html> explains why.



More information about the inn-workers mailing list