summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpierreN <pierreN@users.noreply.github.com>2017-06-16 14:40:11 +0900
committerChristoph Lipka <clipka@users.noreply.github.com>2017-06-16 07:40:11 +0200
commit4aef38e8da1c0f82ca7fbff0dbd6245afaf4c705 (patch)
treee0872c3b745ebc37a8cf2d28bea9a4c7e9d2f3f8
parent2c22c1a605d17b61c4fc17cbc1fc5499b796a39d (diff)
downloadDLT-daemon-4aef38e8da1c0f82ca7fbff0dbd6245afaf4c705.tar.gz
Prevent buffer overflow for mount point path in dlt_logstorage_open_log_file (#19)
Signed-off-by: Pierre N <pierreN@users.noreply.github.com>
-rw-r--r--src/offlinelogstorage/dlt_offline_logstorage_behavior.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/offlinelogstorage/dlt_offline_logstorage_behavior.c b/src/offlinelogstorage/dlt_offline_logstorage_behavior.c
index 125e083..f68d10d 100644
--- a/src/offlinelogstorage/dlt_offline_logstorage_behavior.c
+++ b/src/offlinelogstorage/dlt_offline_logstorage_behavior.c
@@ -387,7 +387,12 @@ int dlt_logstorage_open_log_file(DltLogStorageConfigData *config,
return -1;
}
- sprintf(storage_path, "%s/", dev_path);
+ if(snprintf(storage_path, DLT_OFFLINE_LOGSTORAGE_CONFIG_DIR_PATH_LEN,
+ "%s/", dev_path) >= DLT_OFFLINE_LOGSTORAGE_CONFIG_DIR_PATH_LEN)
+ {
+ dlt_log(LOG_ERR, "Mount point path name too long\n");
+ return -1;
+ }
/* check if there are already files stored */
if (config->records == NULL)