another diff
Peter Jay Salzman
p at dirac.org
Fri Aug 9 19:07:52 EDT 2002
hola,
i think it would be better to use strncpy, just to be safe.
also, the glib library is pretty standard these days. it's been stress
tested by gimp and gtk+. it's not a large library, but provides (among
other things) C++ style strings. strings that can grow and shrink
depending on their contents. as long as you stick with their API, this
eliminates "char *" style buffer overflows.
if everyone thinks it's a good idea, i can work on replacing char *'s to
GStrings. most of the string handling looks like it happens outside of
actual game play, so it wouldn't slow anything down.
if someone doesn't like that idea, i noticed that most string copying
happens with strcpy(). i can work on changing them all to strncpy().
sorry for all the email, but right now i'm getting acquainted with your
code. it's fun seeing how quake works.
pete
--- cvs-twilight-0.1.0/nq/common.c 2001-09-14 23:50:04.000000000 -0700
+++ my-cvs-twilight-0.1.0/nq/common.c 2002-08-09 15:59:12.000000000 -0700
@@ -1536,7 +1536,7 @@
dir = Sys_ExpandPath (indir);
Sys_mkdir (dir);
- strcpy (com_gamedir, dir);
+ strncpy (com_gamedir, dir, MAX_OSPATH - 1);
//
// add the directory to the search path
More information about the twilight-devel
mailing list