Fix truncation warning playlist.c, tree.c

Change-Id: I0c62f06fea3ccb55efa21b719a44a263dedc32e2
This commit is contained in:
William Wilgus 2018-07-25 18:33:10 +02:00
parent 2eeb338e90
commit 2fb6b2b458
2 changed files with 5 additions and 4 deletions

View file

@ -416,7 +416,8 @@ static int check_control(struct playlist_info* playlist)
*/
static int recreate_control(struct playlist_info* playlist)
{
char temp_file[MAX_PATH+1];
const char file_suffix[] = "_temp\0";
char temp_file[MAX_PATH + sizeof(file_suffix)];
int temp_fd = -1;
int i;
int result = 0;
@ -432,8 +433,8 @@ static int recreate_control(struct playlist_info* playlist)
close(playlist->control_fd);
playlist->control_fd = 0;
snprintf(temp_file, sizeof(temp_file), "%s_temp",
playlist->control_filename);
snprintf(temp_file, sizeof(temp_file), "%s%s",
playlist->control_filename, file_suffix);
if (rename(playlist->control_filename, temp_file) < 0)
return -1;

View file

@ -908,7 +908,7 @@ static int dirbrowse(void)
bool create_playlist(void)
{
char filename[MAX_PATH];
char filename[MAX_PATH + 16]; /* add enough space for extension */
if (tc.currdir[1])
snprintf(filename, sizeof filename, "%s.m3u8", tc.currdir);