VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2015-05-31 06:06:39 (GMT)
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2015-05-31 06:09:46 (GMT)
commit550e2bcf3bc1626ccb950c6bc97f1348e94cca76 (patch)
treed727d094cc92b68f4e9347677c5f8340d46f2806 /src/Common
parent57343ce04c984c632599aa53b91846e6e09975ab (diff)
downloadVeraCrypt-550e2bcf3bc1626ccb950c6bc97f1348e94cca76.zip
VeraCrypt-550e2bcf3bc1626ccb950c6bc97f1348e94cca76.tar.gz
Windows: fix buffer overrun issue when parsing language XML file
Diffstat (limited to 'src/Common')
-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 e9d3a57..e5b7a31 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;
}