xmlinterface.cpp: avoid unterminated strings

Signed-off-by: MarkusVolk <f_l_k@t-online.de>
This commit is contained in:
MarkusVolk
2020-01-14 08:55:44 +01:00
committed by Thilo Graf
parent 535bbef5dd
commit 07c991e25e

View File

@@ -311,8 +311,8 @@ xmlDocPtr parseXmlFile(const char * filename, bool,const char* encoding)
size_t read_size = gzread(xmlgz_file,buffer,gzsize);
char utf8[3];
strncpy(utf8,(char *)buffer,3);
char utf8[4];
strncpy(utf8,(char *)buffer,sizeof(utf8)-1);
if ((utf8[0] == 0xef) && (utf8[1] == 0xbb) && (utf8[2] == 0xbf))
enc = pugi::encoding_utf8;