Re: [dev] [PATCH][RFC] bug: copy the command string in order to not sigsegv

From: Marc André Tanner <mat_AT_brain-dump.org>
Date: Sun, 29 Mar 2015 21:28:08 +0200

On Sat, Mar 28, 2015 at 04:54:13PM +0100, Silvan Jegen wrote:
> When using the ZQ/ZZ keybindings we end up writing to a string literal
> which results in a sigsegv. In order to avoid that we have to copy the
> command name string.
>
> Signed-off-by: Silvan Jegen <s.jegen_AT_gmail.com>
> ---
> Heyhey
>
> With this solution to the problem we end up copying all command names
> which I do not like. A better approach would probably be to use function
> pointer *func of struct KeyBinding for ZZ/ZQ to just exit the editor
> (with or without saving) instead of using cmd -> exec_command ->
> exec_cmdline_command.

I'm in the process of separating the ui related code and generally
providing a more library like interface to the the vis core,
exec_command should thus take a const pointer and not modify its
argument. While I agree the copying is somewhat ugly it is probably
the right thing to do.

-- 
 Marc André Tanner >< http://www.brain-dump.org/ >< GPG key: CF7D56C0
Received on Sun Mar 29 2015 - 21:28:08 CEST

This archive was generated by hypermail 2.3.0 : Sun Mar 29 2015 - 21:36:12 CEST