Browse Source

Merge pull request #1884 from devenvexe/devenvexe/12.0-development

Prefer snprintf over sprintf in OpenGL
Sasha Szpakowski 2 years ago
parent
commit
ad96fa6668
1 changed files with 2 additions and 4 deletions
  1. 2 4
      src/modules/graphics/opengl/OpenGL.cpp

+ 2 - 4
src/modules/graphics/opengl/OpenGL.cpp

@@ -2420,8 +2420,7 @@ const char *OpenGL::errorString(GLenum errorcode)
 
 	static char text[64] = {};
 
-	memset(text, 0, sizeof(text));
-	sprintf(text, "0x%x", errorcode);
+	snprintf(text, sizeof(text), "0x%x", errorcode);
 
 	return text;
 }
@@ -2450,8 +2449,7 @@ const char *OpenGL::framebufferStatusString(GLenum status)
 
 	static char text[64] = {};
 
-	memset(text, 0, sizeof(text));
-	sprintf(text, "0x%x", status);
+	snprintf(text, sizeof(text), "0x%x", status);
 
 	return text;
 }