screensaver.cpp: avoid unterminated strings

Signed-off-by: MarkusVolk <f_l_k@t-online.de>


Origin commit data
------------------
Branch: ni/coolstream
Commit: 4a8ae60f69
Author: Markus Volk <f_l_k@t-online.de>
Date: 2020-01-14 (Tue, 14 Jan 2020)



------------------
This commit was generated by Migit
This commit is contained in:
Markus Volk
2020-01-14 21:22:47 +01:00
committed by vanhofen
parent e32f85ac08
commit 2a3fabc2ad

View File

@@ -281,7 +281,7 @@ bool CScreenSaver::ReadDir()
char *dir_name = (char *) d.c_str();
struct dirent *dirpointer;
DIR *dir;
char curr_ext[5];
char curr_ext[6];
bool ret = false;
v_bg_files.clear();
@@ -300,7 +300,7 @@ bool CScreenSaver::ReadDir()
//printf("%d\n",curr_lenght);
if(curr_lenght > 4)
{
strncpy(curr_ext,(*dirpointer).d_name+(curr_lenght-4),5);
strncpy(curr_ext,(*dirpointer).d_name+(curr_lenght-4),sizeof(curr_lenght)-1);
//printf("%s\n",curr_ext);
if (strcasecmp(".jpg",curr_ext) && strcasecmp(".png",curr_ext))