diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2023-07-17 14:28:45 +0200 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2023-07-17 14:28:45 +0200 |
commit | c0785aa1d4b6d988f175ca5732641e6ae2b10cc7 (patch) | |
tree | a50f76e243754b3399f1283fb0d574d0697546a5 | |
parent | 9607b9708cb0fc79a664050802aebf7dcae36e59 (diff) | |
download | VeraCrypt-c0785aa1d4b6d988f175ca5732641e6ae2b10cc7.tar.gz VeraCrypt-c0785aa1d4b6d988f175ca5732641e6ae2b10cc7.zip |
Windows: Fix buffer overrun caused by bug in UpperCaseCopy function
-rw-r--r-- | src/Common/Dlgcode.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c index df5d6355..2cf61415 100644 --- a/src/Common/Dlgcode.c +++ b/src/Common/Dlgcode.c @@ -1584,11 +1584,11 @@ void LowerCaseCopy (wchar_t *lpszDest, const wchar_t *lpszSource) void UpperCaseCopy (wchar_t *lpszDest, size_t cbDest, const wchar_t *lpszSource) { - if (lpszDest && cbDest) + if (lpszDest && (cbDest >= 2)) { size_t i = wcslen (lpszSource); - if (i >= cbDest) - i = cbDest - 1; + if (i >= (cbDest/2)) + i = (cbDest/2) - 1; lpszDest[i] = 0; i++; |