From 5f5bba7078add4a2e482c09b5f93044d482093f4 Mon Sep 17 00:00:00 2001 From: molivier Date: Mon, 26 Aug 2002 06:24:30 +0000 Subject: [PATCH] Fixed a potential buffer overflow in Con_DebugLog git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2288 d7cf8633-e32d-0410-b094-e92efae38249 --- console.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/console.c b/console.c index 14dcb7dc..3311dbc9 100644 --- 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); } -- 2.39.2