Skip to content
Myr

MultiByteToWideChar() usage bug (fix #1072)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Nicolas Williams · committed by Nicolas Williams · parent 8f6f28c · Browse files · 1 file+3 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+3 added−3 removed

  • other:+3 added−3 removed

1 file+3 added−3 removed

modified:src/util.c+3 added-3 removed
46 unmodified lines
4748#ifdef WIN3249FILE *fopen(const char *fname, const char *mode) {50 size_t sz = sizeof(wchar_t) * MultiByteToWideChar(CP_UTF8, 0, fname, -1, NULL, 0);51 wchar_t *wfname = alloca(sz);51 wchar_t *wfname = alloca(sz + 2); // +2 is not needed, but just in case52 MultiByteToWideChar(CP_UTF8, 0, fname, -1, wfname, sz);5354 sz = MultiByteToWideChar(CP_UTF8, 0, mode, -1, NULL, 0);55 wchar_t *wmode = alloca(sz);54 sz = sizeof(wchar_t) * MultiByteToWideChar(CP_UTF8, 0, mode, -1, NULL, 0);55 wchar_t *wmode = alloca(sz); // +2 is not needed, but just in case56 MultiByteToWideChar(CP_UTF8, 0, mode, -1, wmode, sz);57 return _wfopen(wfname, wmode);58}59#endif
401 unmodified lines