VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common/Language.c
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2015-05-31 08:06:39 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2015-05-31 08:09:46 +0200
commit550e2bcf3bc1626ccb950c6bc97f1348e94cca76 (patch)
treed727d094cc92b68f4e9347677c5f8340d46f2806 /src/Common/Language.c
parent57343ce04c984c632599aa53b91846e6e09975ab (diff)
downloadVeraCrypt-550e2bcf3bc1626ccb950c6bc97f1348e94cca76.tar.gz
VeraCrypt-550e2bcf3bc1626ccb950c6bc97f1348e94cca76.zip
Windows: fix buffer overrun issue when parsing language XML file
Diffstat (limited to 'src/Common/Language.c')
-rw-r--r--src/Common/Language.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Common/Language.c b/src/Common/Language.c
index e9d3a573..e5b7a314 100644
--- a/src/Common/Language.c
+++ b/src/Common/Language.c
@@ -87,7 +87,7 @@ static char *MapNextLanguageFile ()
if (find.nFileSizeHigh != 0) return NULL;
if (LanguageFileBuffer != NULL) free (LanguageFileBuffer);
- LanguageFileBuffer = malloc(find.nFileSizeLow);
+ LanguageFileBuffer = malloc(find.nFileSizeLow + 1);
if (LanguageFileBuffer == NULL) return NULL;
GetModuleFileNameW (NULL, f, sizeof (f) / sizeof(f[0]));
@@ -116,6 +116,8 @@ static char *MapNextLanguageFile ()
return NULL;
}
+ LanguageFileBuffer [find.nFileSizeLow] = 0; // we have allocated (find.nFileSizeLow + 1) bytes
+
return LanguageFileBuffer;
}