Browse Source

Null terminate multibyte strings

pull/72/head
Anairkoen Schno 2 years ago
parent
commit
26a07c61f1
Signed by: DaNike GPG Key ID: BEFB74D5F3FC4387
1 changed files with 3 additions and 2 deletions
  1. +3
    -2
      Doorstop/Proxy/main.c

+ 3
- 2
Doorstop/Proxy/main.c View File

@ -195,8 +195,9 @@ void *ownMonoJitInitVersion(const char *root_domain_name, const char *runtime_ve
wchar_t* dll_path_w; // self path
size_t dll_path_len = get_module_path((HINSTANCE)&__ImageBase, &dll_path_w, NULL, 0);
size_t multibyte_path_len = WideCharToMultiByte(CP_UTF8, 0, dll_path_w, dll_path_len, NULL, 0, NULL, NULL);
char* self_dll_path = memalloc(multibyte_path_len);
WideCharToMultiByte(CP_UTF8, 0, dll_path_w, dll_path_len, self_dll_path, multibyte_path_len, NULL, NULL);
char* self_dll_path = memalloc(multibyte_path_len + 1);
WideCharToMultiByte(CP_UTF8, 0, dll_path_w, dll_path_len, self_dll_path, multibyte_path_len + 1, NULL, NULL);
self_dll_path[multibyte_path_len] = 0;
mono_dllmap_insert(NULL, "i:bsipa-doorstop", NULL, self_dll_path, NULL); // remap `bsipa-doorstop` to this assembly


Loading…
Cancel
Save