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/unit/Makefile.inc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tests/unit/Makefile.inc') diff --git a/tests/unit/Makefile.inc b/tests/unit/Makefile.inc index 95d6cb44b..2ba6b5ee5 100644 --- a/tests/unit/Makefile.inc +++ b/tests/unit/Makefile.inc @@ -11,7 +11,7 @@ UNITPROGS = unit1300 unit1301 unit1302 unit1303 unit1304 unit1305 unit1307 \ unit1399 \ unit1600 unit1601 unit1602 unit1603 unit1604 unit1605 unit1606 unit1607 \ unit1608 unit1609 unit1620 \ - unit1650 unit1651 + unit1650 unit1651 unit1652 unit1300_SOURCES = unit1300.c $(UNITFILES) unit1300_CPPFLAGS = $(AM_CPPFLAGS) @@ -105,3 +105,6 @@ unit1650_CPPFLAGS = $(AM_CPPFLAGS) unit1651_SOURCES = unit1651.c $(UNITFILES) unit1651_CPPFLAGS = $(AM_CPPFLAGS) + +unit1652_SOURCES = unit1652.c $(UNITFILES) +unit1652_CPPFLAGS = $(AM_CPPFLAGS) -- cgit v1.2.3