nasmlib/file.c: Win32: add missing filename argument to conversion

In os_mangle_filename() with _WIN32, MultiByteToWideChar() was being
called with five arguments instead of six, missing the actual
string to convert(!)

Fixes: 5dfcfc8cab
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
This commit is contained in:
H. Peter Anvin (Intel) 2026-04-06 16:53:11 -07:00
parent 0dd578ce68
commit 4b37759129

View file

@ -54,14 +54,16 @@ static os_filename os_mangle_filename(const char *filename)
size_t wclen;
wchar_t *buf;
wclen = MultiByteToWideChar(CP_ACP, MB_ERR_INVALID_CHARS, -1, NULL, 0);
wclen = MultiByteToWideChar(CP_ACP, MB_ERR_INVALID_CHARS, filename,
-1, NULL, 0);
if (!wclen)
return NULL;
/* wclen is in "characters" (UTF-16 code points) */
buf = nasm_malloc(wclen << 1);
wclen = MultiByteToWideChar(CP_ACP, MB_ERR_INVALID_CHARS, -1, buf, wclen);
wclen = MultiByteToWideChar(CP_ACP, MB_ERR_INVALID_CHARS, filename,
-1, buf, wclen);
if (!wclen) {
nasm_free(buf);
return NULL;