"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Omar Polo <op@omarpolo.com>
Subject:
Re: tog: deref nlines in check
To:
Mark Jamsek <mark@jamsek.com>
Cc:
Game of Trees <gameoftrees@openbsd.org>
Date:
Thu, 25 Aug 2022 21:41:46 +0200

Download raw body.

Thread
On 2022/08/26 01:43:37 +1000, Mark Jamsek <mark@jamsek.com> wrote:
> Fix typo where we incorrectly check against nlines pointer

yep, I think the intent was to check that *nlines is greater than
zero, not that we have a non NULL pointer :)

ok op@

> diff /home/mark/src/got
> commit - f0680473a7db1e5941bffdc2ab5f80ddec209122
> path + /home/mark/src/got
> blob - 530b713f15da935fc9e60332b0cbd976118130ed
> file + lib/diff.c
> --- lib/diff.c
> +++ lib/diff.c
> @@ -72,7 +72,7 @@ diff_blobs(struct got_diff_line **lines, size_t *nline
>  	off_t outoff = 0;
>  	int n;
>  
> -	if (lines && *lines && nlines > 0)
> +	if (lines && *lines && *nlines > 0)
>  		outoff = (*lines)[*nlines - 1].offset;
>  	else if (lines) {
>  		err = add_line_metadata(lines, nlines, 0, GOT_DIFF_LINE_NONE);