From: res Date: Mon, 17 Dec 2007 03:58:51 +0000 (+0000) Subject: use strlcpy() instead of strcpy() X-Git-Tag: xonotic-v0.1.0preview~2681 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=834d524b6cd5f96d8c70eb241d9cb03c622e0dd2;p=xonotic%2Fdarkplaces.git use strlcpy() instead of strcpy() git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7810 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/zone.c b/zone.c index a945a850..2ab390bd 100644 --- a/zone.c +++ b/zone.c @@ -561,9 +561,10 @@ void MemStats_f(void) char* Mem_strdup (mempool_t *pool, const char* s) { char* p; + size_t sz = strlen (s) + 1; if (s == NULL) return NULL; - p = (char*)Mem_Alloc (pool, strlen (s) + 1); - strcpy (p, s); + p = (char*)Mem_Alloc (pool, sz); + strlcpy (p, s, sz); return p; }