PHYSFS: fix off-by-one error
authorsheepluva
Sun, 03 Sep 2017 19:09:30 +0200
changeset 12456 30da743f118b
parent 12455 8e32d540dab5
child 12457 e18cfe90e4e2
PHYSFS: fix off-by-one error
misc/libphysfs/archiver_zip.c
--- a/misc/libphysfs/archiver_zip.c	Fri Sep 01 11:24:18 2017 -0400
+++ b/misc/libphysfs/archiver_zip.c	Sun Sep 03 19:09:30 2017 +0200
@@ -972,8 +972,8 @@
         BAIL_IF_MACRO(!retval, PHYSFS_ERR_OUT_OF_MEMORY, NULL);
         memset(retval, '\0', sizeof (*retval));
         retval->name = ((char *) retval) + sizeof (ZIPentry);
-        memcpy(retval->name, name, namelen);
-        retval->name[namelen] = '\0';
+        memcpy(retval->name, name, namelen - 1);
+        retval->name[namelen - 1] = '\0';
         retval->resolved = ZIP_DIRECTORY;
         if (!zip_hash_entry(info, retval))
         {