From 14b5c93ba139c8d3a7f8d834379d676d529a0ad5 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Fri, 26 Apr 2013 18:04:20 +1000 Subject: [PATCH] avoid overflowing buffer with GL_EXTENSIONS, from ioquake3 --- codemp/renderer/tr_init.cpp | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/codemp/renderer/tr_init.cpp b/codemp/renderer/tr_init.cpp index fe059cb..63fae51 100644 --- a/codemp/renderer/tr_init.cpp +++ b/codemp/renderer/tr_init.cpp @@ -866,6 +866,27 @@ void GL_SetDefaultState( void ) #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) ); + Com_Printf( "%s", buffer ); + p += 4095; + size -= 4095; + } +} /* ================ @@ -898,7 +919,9 @@ void GfxInfo_f( void ) Com_Printf ("\nGL_VENDOR: %s\n", glConfig.vendor_string ); Com_Printf ("GL_RENDERER: %s\n", glConfig.renderer_string ); Com_Printf ("GL_VERSION: %s\n", glConfig.version_string ); - Com_Printf ("GL_EXTENSIONS: %s\n", glConfig.extensions_string ); + Com_Printf ("GL_EXTENSIONS: " ); + R_PrintLongString( glConfig.extensions_string ); + Com_Printf ("\n"); Com_Printf ("GL_MAX_TEXTURE_SIZE: %d\n", glConfig.maxTextureSize ); Com_Printf ("GL_MAX_ACTIVE_TEXTURES_ARB: %d\n", glConfig.maxActiveTextures ); Com_Printf ("\nPIXELFORMAT: color(%d-bits) Z(%d-bit) stencil(%d-bits)\n", glConfig.colorBits, glConfig.depthBits, glConfig.stencilBits );