Skip to content

Commit 2f6a162

Browse files
committed
Use correct name buffer size
1 parent f7db955 commit 2f6a162

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/symbolize/gimli/libs_windows.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,19 @@ unsafe fn load_library(me: &MODULEENTRY32W) -> Option<Library> {
4848
.iter()
4949
.position(|i| *i == 0)
5050
.unwrap_or(me.szExePath.len());
51-
let mut name_buffer = vec![0_u8; pos * 4];
51+
let name_len = unsafe {
52+
WideCharToMultiByte(
53+
CP_UTF8,
54+
0,
55+
me.szExePath.as_ptr(),
56+
pos as i32,
57+
core::ptr::null_mut(),
58+
0,
59+
core::ptr::null_mut(),
60+
core::ptr::null_mut(),
61+
) as usize
62+
};
63+
let mut name_buffer = vec![0_u8; name_len];
5264
let name_len = unsafe {
5365
WideCharToMultiByte(
5466
CP_UTF8,

0 commit comments

Comments
 (0)