Applied, thanks.

On Sun, Jan 26, 2014 at 07:09:40PM +0100, m0viefreak wrote:
> In case of a partial match (cases where buf is shorter than
> template) the loop was comparing one character too much, ending up
> with comparing \0 in buf which would fail.
> Fix: change pos++ to ++pos
> 
> The incrementation of the template counter has to be done always,
> so the conditions in the loop need to be switched.
> 
> This problem was probably mostly unnoticed, since usually the whole
> sequence is read from the tty in a single buffer.
> However for example on Cygwin the buffer is read byte by byte and
> the bug surfaced.
> ---
>  xterm-keys.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/xterm-keys.c b/xterm-keys.c
> index 8c88587..6916552 100644
> --- a/xterm-keys.c
> +++ b/xterm-keys.c
> @@ -133,7 +133,7 @@ xterm_keys_match(const char *template, const char *buf, 
> size_t len)
>       do {
>               if (*template != '_' && buf[pos] != *template)
>                       return (-1);
> -     } while (pos++ != len && *++template != '\0');
> +     } while (*++template != '\0' && ++pos != len);
>  
>       if (*template != '\0')  /* partial */
>               return (1);
> -- 
> 1.8.5.rc3
> 
> 
> ------------------------------------------------------------------------------
> CenturyLink Cloud: The Leader in Enterprise Cloud Services.
> Learn Why More Businesses Are Choosing CenturyLink Cloud For
> Critical Workloads, Development Environments & Everything In Between.
> Get a Quote or Start a Free Trial Today. 
> http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
> _______________________________________________
> tmux-users mailing list
> tmux-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/tmux-users

------------------------------------------------------------------------------
WatchGuard Dimension instantly turns raw network data into actionable 
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to