<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Mar 16, 2022, at 12:20 AM, Eric Pouech <<a href="mailto:eric.pouech@orange.fr" class="">eric.pouech@orange.fr</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">Le 15/03/2022 à 20:05, Brendan Shanks a écrit :</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">Signed-off-by: Brendan Shanks <<a href="mailto:bshanks@codeweavers.com" class="">bshanks@codeweavers.com</a>><br class="">---<br class=""> programs/winedbg/gdbproxy.c | 9 +++++----<br class=""> 1 file changed, 5 insertions(+), 4 deletions(-)<br class=""><br class="">diff --git a/programs/winedbg/gdbproxy.c b/programs/winedbg/gdbproxy.c<br class="">index 0268a288481..bcde120adeb 100644<br class="">--- a/programs/winedbg/gdbproxy.c<br class="">+++ b/programs/winedbg/gdbproxy.c<br class="">@@ -482,7 +482,6 @@ static BOOL handle_exception(struct gdb_context* gdbctx, EXCEPTION_DEBUG_INFO* e<br class="">     {<br class="">         const THREADNAME_INFO *threadname = (const THREADNAME_INFO *)rec->ExceptionInformation;<br class="">         struct dbg_thread *thread;<br class="">-        char name[9];<br class="">         SIZE_T read;<br class="">           if (threadname->dwType != 0x1000)<br class="">@@ -494,10 +493,12 @@ static BOOL handle_exception(struct gdb_context* gdbctx, EXCEPTION_DEBUG_INFO* e<br class="">         if (thread)<br class="">         {<br class="">             if (gdbctx->process->process_io->read( gdbctx->process->handle,<br class="">-                threadname->szName, name, sizeof(name), &read) && read == sizeof(name))<br class="">+                threadname->szName, thread->name, sizeof(thread->name), &read) &&<br class="">+                read == sizeof(thread->name))<br class=""></blockquote><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">it looks a bit strange to me that we can always expect being able to read sizeof(thread->name) here...</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">using existing memory_get_string helper might be a better idea</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""></div></blockquote></div><br class=""><div class="">Thanks, I hadn’t seen that function before, I’ll use it. I think the end result will be the same though, since memory_get_string() uses the same read() that's implemented with ReadProcessMemory(), which doesn’t do partial reads.</div><div class="">ReadProcessMemory() could fail if sizeof(thread->name) would overflow into an inaccessible page, but for a convenience feature like thread names (and this is the old/deprecated way of setting them) I’m not sure it’s worth handling that rare case.</div><div class=""><br class=""></div><div class="">Brendan</div></body></html>