From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25889 invoked by alias); 18 Feb 2015 16:49:57 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 34568 Received: (qmail 224 invoked from network); 18 Feb 2015 16:49:53 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-CMAE-Score: 0 X-CMAE-Analysis: v=2.1 cv=Kc1larcG c=1 sm=1 tr=0 a=FT8er97JFeGWzr5TCOCO5w==:117 a=kj9zAlcOel0A:10 a=q2GGsy2AAAAA:8 a=oR5dmqMzAAAA:8 a=-9mUelKeXuEA:10 a=0HtSIViG9nkA:10 a=HYshxDoSAAAA:8 a=xjWI1Le0GDYJuSVOHVcA:9 a=CjuIK1q_8ugA:10 a=fKfQlLw1YpgA:10 a=xtMg4yt5JAwA:10 a=vpbdQvQMWPMA:10 From: Bart Schaefer Message-id: <150218084941.ZM21916@torch.brasslantern.com> Date: Wed, 18 Feb 2015 08:49:41 -0800 In-reply-to: <20150218153012.GB18324@math.ethz.ch> Comments: In reply to Theo Buehler "Segfault because metafy() writes to a const char" (Feb 18, 4:30pm) References: <20150218153012.GB18324@math.ethz.ch> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Subject: Re: Segfault because metafy() writes to a const char Cc: Theo Buehler , MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Feb 18, 4:30pm, Theo Buehler wrote: } Subject: Segfault because metafy() writes to a const char } } The following patch fixes this problem for me, however, it effectively } undoes a patch discussed in this thread: } } } http://www.zsh.org/mla/workers/2013/msg01089.html } } and, especially here: } } http://www.zsh.org/mla/workers/2013/msg01091.html If you look at the followup to that message: http://www.zsh.org/mla/workers/2013/msg01092.html ("we need to change the caller") The fix should be this: diff --git a/Src/module.c b/Src/module.c index 7dd4701..368254c 100644 --- a/Src/module.c +++ b/Src/module.c @@ -1601,7 +1601,7 @@ do_load_module(char const *name, int silent) #ifdef HAVE_DLERROR char *errstr = dlerror(); zwarn("failed to load module `%s': %s", name, - errstr ? metafy(errstr, -1, META_USEHEAP) : "empty module path"); + errstr ? metafy(errstr, -1, META_HEAPDUP) : "empty module path"); #else zwarn("failed to load module: %s", name); #endif (Could probably even use META_STATIC there, the dlerror string is not very likely to be too long for PATH_MAX.) It still seems as though we should be able to avoid nul-terminating a string that's already nul-terminated without changing the call sign of metafy().