Fix a memory out-of-bound visit bug.
So len could equal = max_len, and at this point name[len] is out of the range.
BUG=
TEST=
Review URL: https://codereview.appspot.com/7223045
git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1814 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/compiler/ShaderLang.cpp b/src/compiler/ShaderLang.cpp
index 8aed31b..a0aaf98 100644
--- a/src/compiler/ShaderLang.cpp
+++ b/src/compiler/ShaderLang.cpp
@@ -335,7 +335,7 @@
}
strncpy(name, it->first.c_str(), len);
// To be on the safe side in case the source is longer than expected.
- name[len] = '\0';
+ name[len - 1] = '\0';
len = it->second.length() + 1;
max_len = 0;
@@ -346,7 +346,7 @@
}
strncpy(hashedName, it->second.c_str(), len);
// To be on the safe side in case the source is longer than expected.
- hashedName[len] = '\0';
+ hashedName[len - 1] = '\0';
}
void ShGetInfoPointer(const ShHandle handle, ShShaderInfo pname, void** params)