Need to avoid buffer underflow before adding '\0' (encode & decode)