r258911 - Fix array index out of bounds
Daniel Marjamaki via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 26 23:33:50 PST 2016
Author: danielmarjamaki
Date: Wed Jan 27 01:33:50 2016
New Revision: 258911
URL: http://llvm.org/viewvc/llvm-project?rev=258911&view=rev
Log:
Fix array index out of bounds
Differential Revision: http://reviews.llvm.org/D16582
Modified:
cfe/trunk/lib/Driver/MSVCToolChain.cpp
Modified: cfe/trunk/lib/Driver/MSVCToolChain.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/MSVCToolChain.cpp?rev=258911&r1=258910&r2=258911&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/MSVCToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/MSVCToolChain.cpp Wed Jan 27 01:33:50 2016
@@ -141,8 +141,8 @@ static bool getSystemRegistryString(cons
nextKey++;
size_t partialKeyLength = keyEnd - keyPath;
char partialKey[256];
- if (partialKeyLength > sizeof(partialKey))
- partialKeyLength = sizeof(partialKey);
+ if (partialKeyLength >= sizeof(partialKey))
+ partialKeyLength = sizeof(partialKey) - 1;
strncpy(partialKey, keyPath, partialKeyLength);
partialKey[partialKeyLength] = '\0';
HKEY hTopKey = NULL;
More information about the cfe-commits
mailing list