From e3b1fb91c8ea56925aef5e553a30d5642a9c4a5c Mon Sep 17 00:00:00 2001 From: Dragos Oancea Date: Thu, 16 Jan 2020 20:33:16 +0000 Subject: [PATCH] [sofia-sip] fix overflow in logging (tport) [sofia-sip] bump .update --- libs/sofia-sip/.update | 2 +- libs/sofia-sip/libsofia-sip-ua/tport/tport_logging.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libs/sofia-sip/.update b/libs/sofia-sip/.update index 84d396ff55..93e9497fa0 100644 --- a/libs/sofia-sip/.update +++ b/libs/sofia-sip/.update @@ -1 +1 @@ -Wed Dec 11 15:38:35 MST 2019 +Fri Jan 17 15:37:19 UTC 2020 diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/tport_logging.c b/libs/sofia-sip/libsofia-sip-ua/tport/tport_logging.c index ac6003fb0b..7ffe33ac41 100644 --- a/libs/sofia-sip/libsofia-sip-ua/tport/tport_logging.c +++ b/libs/sofia-sip/libsofia-sip-ua/tport/tport_logging.c @@ -866,7 +866,9 @@ void tport_log_msg(tport_t *self, msg_t *msg, } n = su_strncspn(s, end - s, "\r\n"); - + if (buffer_pos > buffer_size) { + break; + } bytes_written = snprintf(buffer + buffer_pos, buffer_size - buffer_pos, "%.*s", (int)n, s); if (bytes_written > 0) { buffer_pos += bytes_written;