From b80b2c50f80dd7e9b8d21241ecf2260d80bef0c8 Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Thu, 18 Jan 2024 07:52:38 -0500 Subject: [PATCH] truncate sip headers that are more than 4k and reject message with 400 Bad Request --- libsofia-sip-ua/tport/tport_logging.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/libsofia-sip-ua/tport/tport_logging.c b/libsofia-sip-ua/tport/tport_logging.c index 2a1156648..f3760a7bf 100644 --- a/libsofia-sip-ua/tport/tport_logging.c +++ b/libsofia-sip-ua/tport/tport_logging.c @@ -830,7 +830,7 @@ void tport_log_msg(tport_t *self, msg_t *msg, #define MSG_SEPARATOR \ "------------------------------------------------------------------------\n" -#define MAX_LINELEN 2047 +#define MAX_LINELEN 4095 for (i = n = 0; i < iovlen && i < 80; i++) n += iov[i].mv_len; @@ -900,9 +900,12 @@ void tport_log_msg(tport_t *self, msg_t *msg, su_log("%s " MSG_SEPARATOR, linelen > 0 ? "\n" : ""); - if (!truncated && i == 80) - truncated = logged; + if (!truncated && i == 80) { + truncated = logged; + } - if (truncated) - su_log(" *** message truncated at "MOD_ZU" ***\n", truncated); + if (truncated) { + su_log(" *** message truncated at "MOD_ZU" ***\n", truncated); + msg_mark_as_complete(msg, MSG_FLG_TRUNC); + } }