Skip to content

Commit 47f0532

Browse files
committed
thcrap: fix buffer overrun in error path
1 parent 04203b0 commit 47f0532

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

thcrap/src/inject.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ int Inject(const HANDLE hProcess, const wchar_t *const dll_dir, const wchar_t *c
250250
"\n"
251251
"\thttp://support.microsoft.com/kb/2533623/";
252252
const size_t injectError1_len = _scwprintf(injectError1Format, dll_fn) + 1;
253-
wchar_t *const injectError1 = (wchar_t*)malloc(injectError1_len);
253+
wchar_t *const injectError1 = (wchar_t*)malloc(injectError1_len * 2);
254254
swprintf(injectError1, injectError1_len, injectError1Format, dll_fn);
255255
MessageBoxW(0, injectError1, L"Error", MB_ICONERROR);
256256
free(injectError1);

0 commit comments

Comments
 (0)