Browse Source

Prefer snprintf over sprintf in OpenGL

Matt Durgavich 2 years ago
parent
commit
c441797976
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;
 }