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
parent 2d619cd3
...@@ -335,7 +335,7 @@ void ShGetNameHashingEntry(const ShHandle handle, ...@@ -335,7 +335,7 @@ void ShGetNameHashingEntry(const ShHandle handle,
} }
strncpy(name, it->first.c_str(), len); strncpy(name, it->first.c_str(), len);
// To be on the safe side in case the source is longer than expected. // 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; len = it->second.length() + 1;
max_len = 0; max_len = 0;
...@@ -346,7 +346,7 @@ void ShGetNameHashingEntry(const ShHandle handle, ...@@ -346,7 +346,7 @@ void ShGetNameHashingEntry(const ShHandle handle,
} }
strncpy(hashedName, it->second.c_str(), len); strncpy(hashedName, it->second.c_str(), len);
// To be on the safe side in case the source is longer than expected. // 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) void ShGetInfoPointer(const ShHandle handle, ShShaderInfo pname, void** params)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment