]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
Fixed a potential buffer overflow in Con_DebugLog
authormolivier <molivier@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 26 Aug 2002 06:24:30 +0000 (06:24 +0000)
committermolivier <molivier@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 26 Aug 2002 06:24:30 +0000 (06:24 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2288 d7cf8633-e32d-0410-b094-e92efae38249

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);
 }