Fix sample basic intToStr was called with wrong length (#2876)

Reported in https://github.com/bytecodealliance/wasm-micro-runtime/issues/2874.
This commit is contained in:
Wenyong Huang
2023-12-07 10:26:28 +08:00
committed by GitHub
parent 0b332d8987
commit f42ffe1d9d
2 changed files with 5 additions and 1 deletions

View File

@ -58,7 +58,7 @@ float_to_string(float n, char *res, int res_size, int afterpoint)
// is needed to handle cases like 233.007
fpart = fpart * get_pow(10, afterpoint);
intToStr((int)fpart, res + i + 1, sizeof(res + i + 1), afterpoint);
intToStr((int)fpart, res + i + 1, res_size - i - 1, afterpoint);
}
}