From 34f56a262b3ce87628df409d6fd4493ea531c9c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Mon, 14 Sep 2015 22:58:14 +0200 Subject: [PATCH] Null-terminate buffer read from language packs --- src/localisation/LanguagePack.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/localisation/LanguagePack.cpp b/src/localisation/LanguagePack.cpp index 0c8739c34c..588dfc5d8e 100644 --- a/src/localisation/LanguagePack.cpp +++ b/src/localisation/LanguagePack.cpp @@ -28,8 +28,9 @@ LanguagePack *LanguagePack::FromFile(int id, const utf8 *path) FileStream fs = FileStream(path, FILE_MODE_OPEN); fileLength = (uint32)fs.GetLength(); - fileData = Memory::Allocate(fileLength); + fileData = Memory::Allocate(fileLength + 1); fs.Read(fileData, fileLength); + fileData[fileLength] = '\0'; fs.Dispose(); } catch (Exception ex) {