summaryrefslogtreecommitdiff
path: root/src/lib/dlt_user.c
diff options
context:
space:
mode:
authorjiripopek <Jiri.Popek@bmw.de>2019-04-04 14:13:34 +0200
committerssugiura <39760799+ssugiura@users.noreply.github.com>2019-04-11 19:55:38 +0900
commit9e5723b75937892e12e68bb2f18f5751ce3d458d (patch)
tree30ec50fc70f83a145e43c4e635023905c9b21e54 /src/lib/dlt_user.c
parenteb3dcd26c80c4ac6e431b09b50b0861b9753ceea (diff)
downloadDLT-daemon-9e5723b75937892e12e68bb2f18f5751ce3d458d.tar.gz
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).
Diffstat (limited to 'src/lib/dlt_user.c')
-rw-r--r--src/lib/dlt_user.c6
1 files changed, 4 insertions, 2 deletions
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) {