return the buffer up to len and not maxlen in ucharbuf