From c37b66aaaed0a36bcb1b19596e897d7ac6219611 Mon Sep 17 00:00:00 2001 From: Daniel Gustafsson Date: Sat, 3 Nov 2018 20:54:18 +0100 Subject: infof: clearly indicate truncation The internal buffer in infof() is limited to 2048 bytes of payload plus an additional byte for NULL termination. Servers with very long error messages can however cause truncation of the string, which currently isn't very clear, and leads to badly formatted output. This appends a "...\n" (or just "..." in case the format didn't with a newline char) marker to the end of the string to clearly show that it has been truncated. Also include a unittest covering infof() to try and catch any bugs introduced in this quite important function. Closes #3216 Reviewed-by: Daniel Stenberg Reviewed-by: Marcel Raad --- tests/data/test1652 | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tests/data/test1652 (limited to 'tests/data/test1652') diff --git a/tests/data/test1652 b/tests/data/test1652 new file mode 100644 index 000000000..c41169019 --- /dev/null +++ b/tests/data/test1652 @@ -0,0 +1,23 @@ + + + +unittest +infof + + + + + +none + + +unittest + + +infof + + +unit1652 + + + -- cgit v1.2.3