[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: [PATCH] vi: fix adjustment of buffer on partial file read
From:       Denys Vlasenko <vda.linux () googlemail ! com>
Date:       2013-03-15 1:16:15
Message-ID: 201303150216.15689.vda.linux () googlemail ! com
[Download RAW message or body]

On Thursday 07 March 2013 21:37, Ron Yorston wrote:
> The second argument to text_hole_delete was incorrect: it should
> be a pointer to the end of the hole.
> 
> Signed-off-by: Ron Yorston <rmy@tigress.co.uk>
> ---
>  editors/vi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/editors/vi.c b/editors/vi.c
> index 7173415..3d6182b 100644
> --- a/editors/vi.c
> +++ b/editors/vi.c
> @@ -2530,7 +2530,7 @@ static int file_insert(const char *fn, char *p, int update_ro_status)
>  		p = text_hole_delete(p, p + size - 1);	// un-do buffer insert
>  	} else if (cnt < size) {
>  		// There was a partial read, shrink unused space text[]
> -		p = text_hole_delete(p + cnt, p + (size - cnt) - 1);	// un-do buffer insert
> +		p = text_hole_delete(p + cnt, p + size - 1);	// un-do buffer insert
>  		status_line_bold("can't read '%s'", fn);
>  	}
>  	if (cnt >= size)

Applied, thanks!
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic