[PATCH setup] Fix an allocation length error

Jon Turney jon.turney@dronecode.org.uk
Thu Mar 19 14:13:27 GMT 2020


Allow for the terminating null.
---
 archive.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/archive.cc b/archive.cc
index e4af4f7..1ceb355 100644
--- a/archive.cc
+++ b/archive.cc
@@ -173,7 +173,7 @@ archive::extract_file (archive * source, const std::string& prefixURL,
 	  break;
 	case ARCHIVE_FILE_DIRECTORY:
 	  {
-	    char *path = (char *) alloca (destfilename.size());
+	    char *path = (char *) alloca (destfilename.size() + 1);
 	    strcpy (path, destfilename.c_str());
 	    while (path[0] && path[strlen (path) - 1] == '/')
 	      path[strlen (path) - 1] = 0;
-- 
2.21.0



More information about the Cygwin-apps mailing list