From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: [PATCH] gnu: Add fontconfig-path-max. Date: Mon, 04 Jul 2016 10:21:16 +0200 Message-ID: <877fd1hkzn.fsf@gnu.org> References: <7b313a7566d04932f94fb33e7a63c222@openmailbox.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:45898) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bJz8A-0004ZZ-81 for guix-devel@gnu.org; Mon, 04 Jul 2016 04:21:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bJz88-0005Fo-5b for guix-devel@gnu.org; Mon, 04 Jul 2016 04:21:25 -0400 In-Reply-To: <7b313a7566d04932f94fb33e7a63c222@openmailbox.org> (rennes@openmailbox.org's message of "Sat, 18 Jun 2016 14:02:51 -0500") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: rennes@openmailbox.org Cc: guix-devel@gnu.org Oops, I spoke too fast. rennes@openmailbox.org skribis: > +++ b/gnu/packages/patches/fontconfig-fcdefault.patch > @@ -0,0 +1,23 @@ > +This patch replaces the use of macro PATH_MAX by *buf constant, > +which allows dynamic memory allocation. > + > +--- > + src/fcdefault.c | 2 +- > + 1 file changed, 1 insertion(+), 1 deletion(-) > + > +diff --git a/src/fcdefault.c b/src/fcdefault.c > +index 6647a8f..8e2094f 100644 > +--- a/src/fcdefault.c > ++++ b/src/fcdefault.c > +@@ -150,7 +150,7 @@ retry: > + # if defined (HAVE_GETEXECNAME) > + const char *p =3D getexecname (); > + # elif defined (HAVE_READLINK) > +- char buf[PATH_MAX + 1]; > ++ char *buf; [...] > + struct stat statb; > +- char f[PATH_MAX + 1]; > ++ char *f; With these changes, the code compiles but will crash at run time, because =E2=80=98f=E2=80=99 and =E2=80=98buf=E2=80=99 are dangling pointers. We should instead use =E2=80=9801_path_max.patch=E2=80=99 from . (In general, for PATH_MAX issues, Debian very likely already has a patch.) Thanks, Ludo=E2=80=99.