Skip to content

Commit

Permalink
truncate sip headers that are more than 4k and reject message with 40…
Browse files Browse the repository at this point in the history
…0 Bad Request
  • Loading branch information
davehorton committed Jan 18, 2024
1 parent 81b17d1 commit b80b2c5
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions libsofia-sip-ua/tport/tport_logging.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}

0 comments on commit b80b2c5

Please sign in to comment.