From 89c6988adb58ae8045d8ff63507427bf9f1c61a0 Mon Sep 17 00:00:00 2001 From: Markus Volk Date: Tue, 14 Jan 2020 21:22:46 +0100 Subject: [PATCH] xmlinterface.cpp: avoid unterminated strings Signed-off-by: MarkusVolk Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/2d93a4385d20310e131d61f3562781d6ba00af4a Author: Markus Volk Date: 2020-01-14 (Tue, 14 Jan 2020) ------------------ This commit was generated by Migit --- lib/xmltree/xmlinterface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/xmltree/xmlinterface.cpp b/lib/xmltree/xmlinterface.cpp index a63903d29..884b1029f 100644 --- a/lib/xmltree/xmlinterface.cpp +++ b/lib/xmltree/xmlinterface.cpp @@ -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;