Re: [PATCH] setup_revisions(): do not access outside argv

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Nguyễn Thái Ngọc Duy schrieb:
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx>
> ---
>  revision.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/revision.c b/revision.c
> index 18b7ebb..be1e307 100644
> --- a/revision.c
> +++ b/revision.c
> @@ -1241,9 +1241,9 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
>  		if (strcmp(arg, "--"))
>  			continue;
>  		argv[i] = NULL;
> -		argc = i;
> -		if (argv[i + 1])
> +		if (i + 1 < argc && argv[i + 1])
>  			revs->prune_data = get_pathspec(revs->prefix, argv + i + 1);
> +		argc = i;
>  		seen_dashdash = 1;
>  		break;
>  	}

Why is this necessary? I'd expect that argv arrays have NULL at the end.
If this is a bug, why did noboy notice this earlier? IOW, your commit
message is really lacking justification.

-- Hannes

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]