]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - console.c
Fixed a potential buffer overflow in Con_DebugLog
[xonotic/darkplaces.git] / console.c
index 14dcb7dcc27ee89704dbb1d45f475f692b280ae7..3311dbc9309772a612945c4fedb4a115a861bc10 100644 (file)
--- a/console.c
+++ b/console.c
@@ -358,15 +358,13 @@ Con_DebugLog
 void Con_DebugLog(char *file, char *fmt, ...)
 {
     va_list argptr;
-    static char data[1024];
-    int fd;
+    FILE* fd;
 
+    fd = fopen(file, "at");
     va_start(argptr, fmt);
-    vsprintf(data, fmt, argptr);
+    vfprintf (fd, fmt, argptr);
     va_end(argptr);
-    fd = open(file, O_WRONLY | O_CREAT | O_APPEND, 0666);
-    write(fd, data, strlen(data));
-    close(fd);
+    fclose(fd);
 }