Fix compiler warning

This commit is contained in:
bnnm 2019-11-24 14:25:33 +01:00
parent 41ede7ce4d
commit b0988dfc87
2 changed files with 6 additions and 6 deletions

View File

@ -594,7 +594,7 @@ static STREAMFILE *open_mapfile_pair(STREAMFILE *streamFile, int track, int num_
continue; continue;
} }
strncpy(buf, mus_name, PATH_LIMIT); strncpy(buf, mus_name, PATH_LIMIT - 1);
pch = strtok(buf, ","); //TODO: not thread safe in std C pch = strtok(buf, ","); //TODO: not thread safe in std C
for (j = 0; j < track && pch; j++) { for (j = 0; j < track && pch; j++) {
pch = strtok(NULL, ","); pch = strtok(NULL, ",");
@ -603,9 +603,9 @@ static STREAMFILE *open_mapfile_pair(STREAMFILE *streamFile, int track, int num_
if (use_mask) { if (use_mask) {
file_name[file_len - map_len] = '\0'; file_name[file_len - map_len] = '\0';
strncat(file_name, pch + 1, PATH_LIMIT); strncat(file_name, pch + 1, PATH_LIMIT - 1);
} else { } else {
strncpy(file_name, pch, PATH_LIMIT); strncpy(file_name, pch, PATH_LIMIT - 1);
} }
musFile = open_streamfile_by_filename(streamFile, file_name); musFile = open_streamfile_by_filename(streamFile, file_name);

View File

@ -690,7 +690,7 @@ static STREAMFILE* open_mapfile_pair(STREAMFILE *streamFile, int track, int num_
continue; continue;
} }
strncpy(buf, mus_name, PATH_LIMIT); strncpy(buf, mus_name, PATH_LIMIT - 1);
pch = strtok(buf, ","); //TODO: not thread safe in std C pch = strtok(buf, ","); //TODO: not thread safe in std C
for (j = 0; j < track && pch; j++) { for (j = 0; j < track && pch; j++) {
pch = strtok(NULL, ","); pch = strtok(NULL, ",");
@ -699,9 +699,9 @@ static STREAMFILE* open_mapfile_pair(STREAMFILE *streamFile, int track, int num_
if (use_mask) { if (use_mask) {
file_name[file_len - map_len] = '\0'; file_name[file_len - map_len] = '\0';
strncat(file_name, pch + 1, PATH_LIMIT); strncat(file_name, pch + 1, PATH_LIMIT - 1);
} else { } else {
strncpy(file_name, pch, PATH_LIMIT); strncpy(file_name, pch, PATH_LIMIT - 1);
} }
musFile = open_streamfile_by_filename(streamFile, file_name); musFile = open_streamfile_by_filename(streamFile, file_name);