use safe string in GetIndexedShader
fix custom shader overflow check
This commit is contained in:
parent
c3437b7833
commit
cbeccc7e3a
|
|
@ -52,7 +52,7 @@ public:
|
|||
}
|
||||
|
||||
StringFixedSize& operator=( const char* string ){
|
||||
return (*this)( string );
|
||||
return operator()( string );
|
||||
}
|
||||
|
||||
template<typename ... Args>
|
||||
|
|
|
|||
|
|
@ -519,8 +519,8 @@ shaderInfo_t *CustomShader( shaderInfo_t *si, const char *find, char *replace ){
|
|||
}
|
||||
|
||||
/* error check */
|
||||
if ( ( strlen( mapName ) + 1 + 32 ) > MAX_QPATH ) {
|
||||
Error( "Custom shader name length (%d) exceeded. Shorten your map name.\n", MAX_QPATH );
|
||||
if ( ( strlen( mapName ) + 1 + 32 ) >= MAX_QPATH ) {
|
||||
Error( "Custom shader name length (%d) exceeded. Shorten your map name.\n", MAX_QPATH - 1 );
|
||||
}
|
||||
|
||||
/* do some bad find-replace */
|
||||
|
|
|
|||
|
|
@ -787,7 +787,6 @@ byte GetShaderIndexForPoint( indexMap_t *im, vec3_t eMins, vec3_t eMaxs, vec3_t
|
|||
shaderInfo_t *GetIndexedShader( shaderInfo_t *parent, indexMap_t *im, int numPoints, byte *shaderIndexes ){
|
||||
int i;
|
||||
byte minShaderIndex, maxShaderIndex;
|
||||
char shader[ MAX_QPATH ];
|
||||
shaderInfo_t *si;
|
||||
|
||||
|
||||
|
|
@ -821,16 +820,10 @@ shaderInfo_t *GetIndexedShader( shaderInfo_t *parent, indexMap_t *im, int numPoi
|
|||
}
|
||||
}
|
||||
|
||||
/* make a shader name */
|
||||
if ( minShaderIndex == maxShaderIndex ) {
|
||||
sprintf( shader, "textures/%s_%d", im->shader, maxShaderIndex );
|
||||
}
|
||||
else{
|
||||
sprintf( shader, "textures/%s_%dto%d", im->shader, minShaderIndex, maxShaderIndex );
|
||||
}
|
||||
|
||||
/* get the shader */
|
||||
si = ShaderInfoForShader( shader );
|
||||
si = ShaderInfoForShader( ( minShaderIndex == maxShaderIndex )?
|
||||
String64()( "textures/", im->shader, '_', int(maxShaderIndex) ):
|
||||
String64()( "textures/", im->shader, '_', int(minShaderIndex), "to", int(maxShaderIndex) ) );
|
||||
|
||||
/* inherit a few things from parent shader */
|
||||
if ( parent->globalTexture ) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user