fix a buffer overflow (ouch)

This commit is contained in:
Bill Currie 2003-09-02 20:20:54 +00:00
parent 11538d4745
commit 36f8dbf75a
1 changed files with 3 additions and 3 deletions

View File

@ -37,6 +37,7 @@ static __attribute__ ((unused)) const char rcsid[] =
#include "QF/dstring.h" #include "QF/dstring.h"
#include "QF/quakefs.h" #include "QF/quakefs.h"
#include "QF/sys.h" #include "QF/sys.h"
#include "QF/va.h"
#include "bsp5.h" #include "bsp5.h"
@ -616,7 +617,6 @@ void
WriteEntitiesToString (void) WriteEntitiesToString (void)
{ {
dstring_t *buf; dstring_t *buf;
char line[128];
epair_t *ep; epair_t *ep;
int i; int i;
@ -630,8 +630,8 @@ WriteEntitiesToString (void)
dstring_appendstr (buf, "{\n"); dstring_appendstr (buf, "{\n");
for (ep = entities[i].epairs; ep; ep = ep->next) { for (ep = entities[i].epairs; ep; ep = ep->next) {
sprintf (line, "\"%s\" \"%s\"\n", ep->key, ep->value); dstring_appendstr (buf, va ("\"%s\" \"%s\"\n",
dstring_appendstr (buf, line); ep->key, ep->value));
} }
dstring_appendstr (buf, "}\n"); dstring_appendstr (buf, "}\n");
} }