otrl_base64_encode handling len issue
otrl_base64_encode returns the number of bytes actually used, which may be less than ((datalen+2)/3)*4.
otrl_base64_otr_encode ignores what otrl_base64_encode returns, say n, and may fail to initialize bytes
base64buf[5 + n], base64buf[5 + n + 1], ..., base64buf[5 + n + (((datalen+2)/3)*4 - n - 1)].
The first byte it initializes after the (potential) gap is
base64buf[5 + (((datalen+2)/3)*4)],
which it sets to '.'.
otrl_base64_otr_encode should instead do something like:
size_t base64len_max, base64len; base64len_max = ((buflen + 2) / 3) * 4; ... base64len = otrl_base64_otr_encode(base64buf+5, buf, buflen); assert(base64len <= base64len_max);
This has been reported by Riastradh on #otr
(from redmine: created on 2014-07-30)