diff --git a/src/os/src/detail/osString.c b/src/os/src/detail/osString.c index 2c49797d83dd4bb53b2fef69091e28be7194461e..fdc70b667e08face21554c99e2109bc49cf41cbf 100644 --- a/src/os/src/detail/osString.c +++ b/src/os/src/detail/osString.c @@ -59,6 +59,9 @@ bool taosMbsToUcs4(char *mbs, size_t mbsLength, char *ucs4, int32_t ucs4_max_len iconv_close(cd); if (len != NULL) { *len = (int32_t)(ucs4_max_len - outLeft); + if (*len < 0) { + return false; + } } return true;