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

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: fix lib/object_parse.c comparison typo
To:
Mark Jamsek <mark@jamsek.com>
Cc:
Game of Trees <gameoftrees@openbsd.org>
Date:
Wed, 18 Jan 2023 10:17:52 +0100

Download raw body.

Thread
On Wed, Jan 18, 2023 at 03:56:03PM +1100, Mark Jamsek wrote:
> As per the subject line, fix typo that makes overlapping comparison
> always evaluate false:

Oops, ok

I hope this won't result in unexpected tree object parsing errors
we never saw before, but it should be fine.

> diff /home/mark/src/got
> commit - f4e8c21cb2dc6a468bae32a4dcf3a9e18f269527
> path + /home/mark/src/got
> blob - d462598db9e15145bb7cda1fc9ca7357de35b04a
> file + lib/object_parse.c
> --- lib/object_parse.c
> +++ lib/object_parse.c
> @@ -824,7 +824,7 @@ parse_tree_entry(struct got_parsed_tree_entry *pte, si
>  	pte->mode = 0;
>  	p = buf;
>  	while (p < space) {
> -		if (*p < '0' && *p > '7')
> +		if (*p < '0' || *p > '7')
>  			return got_error(GOT_ERR_BAD_OBJ_DATA);
>  		pte->mode <<= 3;
>  		pte->mode |= *p - '0';
> 
> -- 
> Mark Jamsek <fnc.bsdbox.org>
> GPG: F2FF 13DE 6A06 C471 CA80  E6E2 2930 DC66 86EE CF68