[147973] trunk/dports/editors/nano

jeremyhu at macports.org jeremyhu at macports.org
Thu Apr 21 20:52:31 PDT 2016


Revision: 147973
          https://trac.macports.org/changeset/147973
Author:   jeremyhu at macports.org
Date:     2016-04-21 20:52:31 -0700 (Thu, 21 Apr 2016)
Log Message:
-----------
nano: Fix a crash at launch when opening multiple files (#51201)

Modified Paths:
--------------
    trunk/dports/editors/nano/Portfile

Added Paths:
-----------
    trunk/dports/editors/nano/files/PR-51201-use-after-free.patch

Modified: trunk/dports/editors/nano/Portfile
===================================================================
--- trunk/dports/editors/nano/Portfile	2016-04-22 03:34:41 UTC (rev 147972)
+++ trunk/dports/editors/nano/Portfile	2016-04-22 03:52:31 UTC (rev 147973)
@@ -5,6 +5,7 @@
 
 name            nano
 version         2.5.3
+revision        1
 categories      editors
 platforms       darwin freebsd
 license         GPL-3
@@ -29,7 +30,8 @@
                 port:ncurses \
                 port:zlib
 
-patchfiles      nawk.patch
+patchfiles      nawk.patch \
+                PR-51201-use-after-free.patch
 
 configure.args  --disable-wrapping-as-root \
                 --enable-nanorc \

Added: trunk/dports/editors/nano/files/PR-51201-use-after-free.patch
===================================================================
--- trunk/dports/editors/nano/files/PR-51201-use-after-free.patch	                        (rev 0)
+++ trunk/dports/editors/nano/files/PR-51201-use-after-free.patch	2016-04-22 03:52:31 UTC (rev 147973)
@@ -0,0 +1,18 @@
+The pointer returned by dirname(3) is not to memory owned by the caller.  Thus,
+the true branch was setting parentdir to an owned region and the false region
+was not.  This change corrects the incorrect freeing of the pointer returned
+by dirname as well as the memory leak of the argument to dirname.
+
+See https://trac.macports.org/ticket/51201
+
+--- src/files.c.orig	2016-02-25 12:47:10.000000000 -0800
++++ src/files.c	2016-04-21 20:47:15.000000000 -0700
+@@ -43,7 +43,7 @@ bool has_valid_path(const char *filename
+     if (strrchr(filename, '/') == NULL)
+ 	parentdir = mallocstrcpy(NULL, ".");
+     else
+-	parentdir = dirname(mallocstrcpy(NULL, filename));
++	parentdir = mallocstrcpy(NULL, dirname(filename));
+ 
+     if (stat(parentdir, &parentinfo) == -1) {
+ 	if (errno == ENOENT)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20160421/ca547719/attachment.html>


More information about the macports-changes mailing list