diff options
author | Felix Herrmann <fherrmann@de.adit-jv.com> | 2020-01-13 10:40:25 +0100 |
---|---|---|
committer | Saya Sugiura <39760799+ssugiura@users.noreply.github.com> | 2020-07-06 10:04:07 +0900 |
commit | 676e8fc1ba927dc84df82b508d796e31d9fd120c (patch) | |
tree | 141271d339f1ba68d0b29fd124e8eaa5d3d99fd4 /src/shared/dlt_offline_trace.c | |
parent | ec391decd94ac9f6c6133c24a41c8afb2c01623f (diff) | |
download | DLT-daemon-676e8fc1ba927dc84df82b508d796e31d9fd120c.tar.gz |
fix some gcc9 compiler warnings
Many stringop-truncation and stringop-overflow warnings are still
there (so many).
https://developers.redhat.com/blog/2018/05/24/detecting-string-truncation-with-gcc-8/
Signed-off-by: Felix Herrmann <fherrmann@de.adit-jv.com>
Signed-off-by: KHANH LUONG HONG DUY <khanh.luonghongduy@vn.bosch.com>
Diffstat (limited to 'src/shared/dlt_offline_trace.c')
-rw-r--r-- | src/shared/dlt_offline_trace.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/shared/dlt_offline_trace.c b/src/shared/dlt_offline_trace.c index 060b97f..1f6a5d5 100644 --- a/src/shared/dlt_offline_trace.c +++ b/src/shared/dlt_offline_trace.c @@ -116,13 +116,15 @@ unsigned int dlt_offline_trace_storage_dir_info(char *path, char *file_name, cha } if (num > 0) { - if (tmp_old != NULL) - if (strlen(tmp_old) < NAME_MAX) - strncpy(oldest, tmp_old, NAME_MAX); + if ((tmp_old != NULL) && (strlen(tmp_old) < NAME_MAX)) { + strncpy(oldest, tmp_old, NAME_MAX); + oldest[NAME_MAX] = '\0'; + } - if (tmp_new != NULL) - if (strlen(tmp_old) < NAME_MAX) - strncpy(newest, tmp_new, NAME_MAX); + if ((tmp_new != NULL) && (strlen(tmp_old) < NAME_MAX)) { + strncpy(newest, tmp_new, NAME_MAX); + oldest[NAME_MAX] = '\0'; + } } /* free scandir result */ |