From b0988dfc87945cfd9b51d439aaa871ddbde5ecae Mon Sep 17 00:00:00 2001 From: bnnm Date: Sun, 24 Nov 2019 14:25:33 +0100 Subject: [PATCH] Fix compiler warning --- src/meta/ea_eaac.c | 6 +++--- src/meta/ea_schl.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/meta/ea_eaac.c b/src/meta/ea_eaac.c index cb339c34..bd3e90e2 100644 --- a/src/meta/ea_eaac.c +++ b/src/meta/ea_eaac.c @@ -594,7 +594,7 @@ static STREAMFILE *open_mapfile_pair(STREAMFILE *streamFile, int track, int num_ continue; } - strncpy(buf, mus_name, PATH_LIMIT); + strncpy(buf, mus_name, PATH_LIMIT - 1); pch = strtok(buf, ","); //TODO: not thread safe in std C for (j = 0; j < track && pch; j++) { pch = strtok(NULL, ","); @@ -603,9 +603,9 @@ static STREAMFILE *open_mapfile_pair(STREAMFILE *streamFile, int track, int num_ if (use_mask) { file_name[file_len - map_len] = '\0'; - strncat(file_name, pch + 1, PATH_LIMIT); + strncat(file_name, pch + 1, PATH_LIMIT - 1); } else { - strncpy(file_name, pch, PATH_LIMIT); + strncpy(file_name, pch, PATH_LIMIT - 1); } musFile = open_streamfile_by_filename(streamFile, file_name); diff --git a/src/meta/ea_schl.c b/src/meta/ea_schl.c index ea6b09d1..c85a58c4 100644 --- a/src/meta/ea_schl.c +++ b/src/meta/ea_schl.c @@ -690,7 +690,7 @@ static STREAMFILE* open_mapfile_pair(STREAMFILE *streamFile, int track, int num_ continue; } - strncpy(buf, mus_name, PATH_LIMIT); + strncpy(buf, mus_name, PATH_LIMIT - 1); pch = strtok(buf, ","); //TODO: not thread safe in std C for (j = 0; j < track && pch; j++) { pch = strtok(NULL, ","); @@ -699,9 +699,9 @@ static STREAMFILE* open_mapfile_pair(STREAMFILE *streamFile, int track, int num_ if (use_mask) { file_name[file_len - map_len] = '\0'; - strncat(file_name, pch + 1, PATH_LIMIT); + strncat(file_name, pch + 1, PATH_LIMIT - 1); } else { - strncpy(file_name, pch, PATH_LIMIT); + strncpy(file_name, pch, PATH_LIMIT - 1); } musFile = open_streamfile_by_filename(streamFile, file_name);