Bugzilla – Attachment 329 Details for
Bug 1031
Invalid memory access in wc_to_utf8()
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Suggested fix
file_1031.txt (text/plain), 736 bytes, created by
Martin Jackson
on 2017-09-10 00:37:48 CEST
(
hide
)
Description:
Suggested fix
Filename:
MIME Type:
Creator:
Martin Jackson
Created:
2017-09-10 00:37:48 CEST
Size:
736 bytes
patch
obsolete
>diff --git a/windows.c b/windows.c >index 644a701..360da73 100644 >--- a/windows.c >+++ b/windows.c >@@ -30,12 +30,13 @@ static void enumerate_hub(struct sp_port *port, const char *hub_name, > > static char *wc_to_utf8(PWCHAR wc_buffer, ULONG size) > { >- WCHAR wc_str[(size / sizeof(WCHAR)) + 1]; >+ ULONG wc_length = size / sizeof(WCHAR); >+ WCHAR wc_str[wc_length + 1]; > char *utf8_str; > > /* Zero-terminate the wide char string. */ > memcpy(wc_str, wc_buffer, size); >- wc_str[sizeof(wc_str) - 1] = 0; >+ wc_str[wc_length] = 0; > > /* Compute the size of the UTF-8 converted string. */ > if (!(size = WideCharToMultiByte(CP_ACP, WC_NO_BEST_FIT_CHARS, wc_str, -1,
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 1031
: 329