From 9a2c2170fa5cda23ed0119dcf0f70ef0386a21de Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Sat, 24 Dec 2011 12:02:25 +0000 Subject: [PATCH] tidy up nul termination for strncpy in CFG_ReadCvarOverrides (from Sander.) update copyright years. git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@540 af15c1b1-3010-417e-b628-4374ebc0bcbd --- Quake/cfgfile.c | 8 +++----- Quake/cfgfile.h | 4 +--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/Quake/cfgfile.c b/Quake/cfgfile.c index a0a37311..364b5f69 100644 --- a/Quake/cfgfile.c +++ b/Quake/cfgfile.c @@ -2,9 +2,7 @@ cfgfile.c misc reads from the config file - $Id: cfgfile.c 3880 2011-01-28 21:50:19Z sezero $ - - Copyright (C) 2008-2010 O.Sezer + Copyright (C) 2008-2011 O.Sezer This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -126,11 +124,11 @@ void CFG_ReadCvarOverrides (const char **vars, int num_vars) return; buff[0] = '+'; + buff[sizeof(buff) - 1] = '\0'; for (i = 0; i < num_vars; i++) { - strncpy (&buff[1], vars[i], sizeof(buff) - 1); - buff[sizeof(buff) - 1] = 0; + strncpy (&buff[1], vars[i], sizeof(buff) - 2); j = COM_CheckParm(buff); if (j != 0 && j < com_argc - 1) { diff --git a/Quake/cfgfile.h b/Quake/cfgfile.h index 617e27d7..5ad09d9d 100644 --- a/Quake/cfgfile.h +++ b/Quake/cfgfile.h @@ -2,9 +2,7 @@ cfgfile.h misc reads from the config file - $Id: cfgfile.h 3862 2010-12-30 20:51:57Z sezero $ - - Copyright (C) 2008-2010 O.Sezer + Copyright (C) 2008-2011 O.Sezer This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License