fix: Ensure proper closure of variadic function in mjs_array (#3798)

The changes ensure that the `va_end` function is always called after `c_vsnprintf` in `mjs_array.c`

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
DerSkythe 2024-07-31 21:12:26 +04:00 committed by GitHub
parent 01b402ba2b
commit 56fef61c66
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -19,8 +19,11 @@
static int v_sprintf_s(char* buf, size_t size, const char* fmt, ...) {
size_t n;
va_list ap;
va_start(ap, fmt);
n = c_vsnprintf(buf, size, fmt, ap);
va_end(ap);
if(n > size) {
return size;
}