From 646f76c58bc81b2d41163b2e9dfcf279ebd9e887 Mon Sep 17 00:00:00 2001 From: Radoslaw Kaczorowski Date: Mon, 17 Jun 2019 11:19:22 +0700 Subject: define DLT_PATH_MAX for max path buffer length DLT limits the path length and does not do anything else to determine the actual value, because the least that is supported on any system that DLT runs on is 1024 bytes. Signed-off-by: Vo Trung Chi --- src/shared/dlt_common.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/shared') diff --git a/src/shared/dlt_common.c b/src/shared/dlt_common.c index 4d6fcee..8f5bc76 100644 --- a/src/shared/dlt_common.c +++ b/src/shared/dlt_common.c @@ -67,7 +67,7 @@ const char dltSerialHeader[DLT_ID_SIZE] = { 'D', 'L', 'S', 1 }; char dltSerialHeaderChar[DLT_ID_SIZE] = { 'D', 'L', 'S', 1 }; -char dltFifoBaseDir[PATH_MAX + 1] = "/tmp"; +char dltFifoBaseDir[DLT_PATH_MAX] = "/tmp"; /* internal logging parameters */ static int logging_mode = DLT_LOG_TO_CONSOLE; @@ -1701,8 +1701,8 @@ void dlt_log_set_filename(const char *filename) void dlt_log_set_fifo_basedir(const char *env_pipe_dir) { - strncpy(dltFifoBaseDir, env_pipe_dir, PATH_MAX); - dltFifoBaseDir[PATH_MAX] = 0; + strncpy(dltFifoBaseDir, env_pipe_dir, DLT_PATH_MAX); + dltFifoBaseDir[DLT_PATH_MAX - 1] = 0; } void dlt_log_init(int mode) @@ -2495,7 +2495,7 @@ int dlt_buffer_push3(DltBuffer *buf, } /* set header */ - strncpy(head.head, DLT_BUFFER_HEAD, 3); + strncpy(head.head, DLT_BUFFER_HEAD, 4); head.head[3] = 0; head.status = 2; head.size = size1 + size2 + size3; -- cgit v1.2.1