Re: [PATCH v5 2/5] setup: sanity check file size in read_gitfile_gently

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

 



Erik Elfström <erik.elfstrom@xxxxxxxxx> writes:

> diff --git a/setup.c b/setup.c
> index c4538ca..792c37b 100644
> --- a/setup.c
> +++ b/setup.c
> @@ -364,6 +364,10 @@ const char *read_gitfile_gently(const char *path, int *return_error_code)
>  		error_code = READ_GITFILE_ERR_OPEN_FAILED;
>  		goto cleanup_return;
>  	}
> +	if (st.st_size > PATH_MAX * 4) {
> +		error_code = READ_GITFILE_ERR_TOO_LARGE;

You have fd already open for the path at this point.  When you
reroll, please do not forget to close(fd) here.

> +		goto cleanup_return;
> +	}
--
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]