avoid overflowing buffer with GL_EXTENSIONS, from ioquake3

This commit is contained in:
Jonathan Gray 2013-04-20 22:41:21 +10:00
parent d83a25cc1e
commit 5ed4e4ca50
1 changed files with 24 additions and 1 deletions

View File

@ -856,6 +856,27 @@ void GL_SetDefaultState( void )
#endif #endif
} }
/*
================
R_PrintLongString
Workaround for VID_Printf's 4096 characters buffer limit.
================
*/
void R_PrintLongString(const char *string) {
char buffer[4096];
const char *p;
int size = strlen(string);
p = string;
while(size > 0)
{
Q_strncpyz(buffer, p, sizeof (buffer) );
VID_Printf( PRINT_ALL, "%s", buffer );
p += 4095;
size -= 4095;
}
}
/* /*
================ ================
@ -888,7 +909,9 @@ void GfxInfo_f( void )
VID_Printf( PRINT_ALL, "\nGL_VENDOR: %s\n", glConfig.vendor_string ); VID_Printf( PRINT_ALL, "\nGL_VENDOR: %s\n", glConfig.vendor_string );
VID_Printf( PRINT_ALL, "GL_RENDERER: %s\n", glConfig.renderer_string ); VID_Printf( PRINT_ALL, "GL_RENDERER: %s\n", glConfig.renderer_string );
VID_Printf( PRINT_ALL, "GL_VERSION: %s\n", glConfig.version_string ); VID_Printf( PRINT_ALL, "GL_VERSION: %s\n", glConfig.version_string );
VID_Printf( PRINT_ALL, "GL_EXTENSIONS: %s\n", glConfig.extensions_string ); VID_Printf( PRINT_ALL, "GL_EXTENSIONS: " );
R_PrintLongString( glConfig.extensions_string );
VID_Printf( PRINT_ALL, "\n" );
VID_Printf( PRINT_ALL, "GL_MAX_TEXTURE_SIZE: %d\n", glConfig.maxTextureSize ); VID_Printf( PRINT_ALL, "GL_MAX_TEXTURE_SIZE: %d\n", glConfig.maxTextureSize );
VID_Printf( PRINT_ALL, "GL_MAX_ACTIVE_TEXTURES_ARB: %d\n", glConfig.maxActiveTextures ); VID_Printf( PRINT_ALL, "GL_MAX_ACTIVE_TEXTURES_ARB: %d\n", glConfig.maxActiveTextures );
VID_Printf( PRINT_ALL, "\nPIXELFORMAT: color(%d-bits) Z(%d-bit) stencil(%d-bits)\n", glConfig.colorBits, glConfig.depthBits, glConfig.stencilBits ); VID_Printf( PRINT_ALL, "\nPIXELFORMAT: color(%d-bits) Z(%d-bit) stencil(%d-bits)\n", glConfig.colorBits, glConfig.depthBits, glConfig.stencilBits );