Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Segfault because metafy() writes to a const char



On Wed, Feb 18, 2015 at 08:49:41AM -0800, Bart Schaefer wrote:
> On Feb 18,  4:30pm, Theo Buehler wrote:
>
> 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

Thank you for the immediate response.  This patch indeed seems to be
correct.  It fixes the problem both with zsh 5.0.5 and 5.0.7 on
OpenBSD-current.



Messages sorted by: Reverse Date, Date, Thread, Author