From 61401f24ef91b8b4321fd250c5942e9ec6ed3076 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Sat, 22 Oct 2016 22:39:31 +0200 Subject: [PATCH] strace: Add comment trying to explain confusing code Signed-off-by: Corinna Vinschen --- winsup/utils/strace.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/winsup/utils/strace.cc b/winsup/utils/strace.cc index 5d4a23d0f..eb96a61b6 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;