[PATCH v2 1/2] libs/port/mbtowc: Handle partially overlapped buffers