BUG/MINOR: trace: stop rewriting argv with -dt
authorWilliam Lallemand <wlallemand@haproxy.com>
Tue, 29 Oct 2024 09:50:27 +0000 (10:50 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 6 Nov 2024 14:46:27 +0000 (15:46 +0100)
commit6bec3fbe6fb2eb5f9c74ff27ca894dd34c4d7c5a
tree0671cc734098ca5e9e071939e969487d8e2a20e4
parentcdb7dac9821fc1ded2d4c706142bc4132140d3d2
BUG/MINOR: trace: stop rewriting argv with -dt

When using trace with -dt, the trace_parse_cmd() function is doing a
strtok which write \0 into the argv string.

When using the mworker mode, and reloading, argv was modified and the
trace won't work anymore because the first : is replaced by a '\0'.

This patch fixes the issue by allocating a temporary string so we don't
modify the source string directly. It also replace strtok by its
reentrant version strtok_r.

Must be backported as far as 2.9.

(cherry picked from commit 596db3ef86844617565a0b4b4ce8358fe6537d87)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
include/haproxy/trace.h
src/trace.c