if (len > 0)
if (len > 0 && olen > 4)
void mutt_to_base64 (unsigned char *out, const unsigned char *in, int len){  while (len >= 3)  {    *out++ = B64Chars[in[0] >> 2];    *out++ = B64Chars[((in[0] << 4) & 0x30) | (in[1] >> 4)];    *out++ = B64Chars[((in[1] << 2) & 0x3c) | (in[2] >> 6)];    *out++ = B64Chars[in[2] & 0x3f];    len -= 3;    in += 3;  }  /* clean up remainder */  if (len > 0)  {    unsigned char fragment;    *out++ = B64Chars[in[0] >> 2];    fragment = (in[0] << 4) & 0x30;    if (len > 1)      fragment |= in[1] >> 4;    *out++ = B64Chars[fragment];    *out++ = (len < 2) ? '=' : B64Chars[(in[1] << 2) & 0x3c];    *out++ = '=';  }  *out = '\0';}