]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
use strlcpy() instead of strcpy()
authorres <res@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 17 Dec 2007 03:58:51 +0000 (03:58 +0000)
committerres <res@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 17 Dec 2007 03:58:51 +0000 (03:58 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7810 d7cf8633-e32d-0410-b094-e92efae38249

zone.c

diff --git a/zone.c b/zone.c
index a945a85084be6d9c85301e19111825b319a3bb0c..2ab390bd8ae8e0bba09ad3f564d139c55b288b74 100644 (file)
--- 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;
 }