Bug 751643 - ensure that strings produced by ANGLE's getVariableInfo function are null-terminated - r=bz,upstream

Checked in upstream ANGLE as r1070.
This commit is contained in:
Benoit Jacob 2012-05-06 22:20:03 -04:00
parent 4ebdb294b4
commit 4b973ad9e6

View File

@ -72,12 +72,14 @@ static void getVariableInfo(ShShaderInfo varType,
int activeUniformAndAttribLength = 1 + MAX_SYMBOL_NAME_LEN;
ASSERT(checkActiveUniformAndAttribMaxLengths(handle, activeUniformAndAttribLength));
strncpy(name, varInfo.name.c_str(), activeUniformAndAttribLength);
name[activeUniformAndAttribLength - 1] = 0;
if (mappedName) {
// This size must match that queried by
// SH_MAPPED_NAME_MAX_LENGTH in ShGetInfo, below.
int maxMappedNameLength = 1 + MAX_SYMBOL_NAME_LEN;
ASSERT(checkMappedNameMaxLength(handle, maxMappedNameLength));
strncpy(mappedName, varInfo.mappedName.c_str(), maxMappedNameLength);
mappedName[maxMappedNameLength - 1] = 0;
}
}