https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=61401f24ef91b8b4321fd250c5942e9ec6ed3076
commit 61401f24ef91b8b4321fd250c5942e9ec6ed3076 Author: Corinna Vinschen <cori...@vinschen.de> Date: Sat Oct 22 22:39:31 2016 +0200 strace: Add comment trying to explain confusing code Signed-off-by: Corinna Vinschen <cori...@vinschen.de> Diff: --- winsup/utils/strace.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/winsup/utils/strace.cc b/winsup/utils/strace.cc index 5d4a23d..eb96a61 100644 --- a/winsup/utils/strace.cc +++ b/winsup/utils/strace.cc @@ -472,6 +472,12 @@ handle_output_debug_string (DWORD id, LPVOID p, unsigned mask, FILE *ofile) len = 17; } + /* Note that the following code deliberately points buf 20 bytes into the + allocated area. The subsequent code then overwrites the usecs value + given in the application's debug string, which potentially prepends + characters to the string. If that sounds confusing and dangerous, well... + + TODO: This needs a cleanup. */ char *buf; buf = (char *) alloca (len + 85) + 20;