From 9e5723b75937892e12e68bb2f18f5751ce3d458d Mon Sep 17 00:00:00 2001 From: jiripopek Date: Thu, 4 Apr 2019 14:13:34 +0200 Subject: Fixed memory leak when receiving network traces of 0xFFFF length 0xFFFF was used as a magic number in the length field of a network message in order to trigger a resend. DLT library will now use the nw_trace_type field and a custom type to do this, thus assuring no external client of the library can reach this value(DLT_NW_TRACE_RESEND). --- src/lib/dlt_user.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/lib/dlt_user.c b/src/lib/dlt_user.c index cb7f570..43fb025 100644 --- a/src/lib/dlt_user.c +++ b/src/lib/dlt_user.c @@ -2956,7 +2956,8 @@ void dlt_user_trace_network_segmented_thread(void *unused) } /* Indicator just to try to flush the buffer */ - if (data->payload_len == DLT_DELAYED_RESEND_INDICATOR_PATTERN) { + /* DLT_NW_TRACE_RESEND custom type is used to mark a resend */ + if(data->nw_trace_type == DLT_NW_TRACE_RESEND) { /* Sleep 100ms, to allow other process to read FIFO */ usleep(100 * 1000); @@ -3530,7 +3531,8 @@ DltReturnValue dlt_user_queue_resend(void) if (resend_data == NULL) return DLT_RETURN_ERROR; - resend_data->payload_len = DLT_DELAYED_RESEND_INDICATOR_PATTERN; + /* DLT_NW_TRACE_RESEND custom type is used to mark a resend */ + resend_data->nw_trace_type = DLT_NW_TRACE_RESEND; /* Open queue if it is not open */ if (dlt_init_message_queue() < DLT_RETURN_OK) { -- cgit v1.2.1