[PATCH] D16582: fix array index out of bounds
Daniel Marjamäki via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 26 23:38:02 PST 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL258911: Fix array index out of bounds (authored by danielmarjamaki).
Changed prior to commit:
http://reviews.llvm.org/D16582?vs=45991&id=46102#toc
Repository:
rL LLVM
http://reviews.llvm.org/D16582
Files:
cfe/trunk/lib/Driver/MSVCToolChain.cpp
Index: cfe/trunk/lib/Driver/MSVCToolChain.cpp
===================================================================
--- cfe/trunk/lib/Driver/MSVCToolChain.cpp
+++ cfe/trunk/lib/Driver/MSVCToolChain.cpp
@@ -141,8 +141,8 @@
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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16582.46102.patch
Type: text/x-patch
Size: 628 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160127/6f04bf6c/attachment.bin>
More information about the cfe-commits
mailing list