-
Notifications
You must be signed in to change notification settings - Fork 27.2k
bundle-uri: validate that bundle entries have a uri #2134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
e940fdb to
3d8a014
Compare
|
/submit |
|
Submitted as [email protected] To fetch this version into To fetch this version to local tag |
|
On the Git mailing list, Junio C Hamano wrote (reply to this): "Sam Bostock via GitGitGadget" <[email protected]> writes:
> bundle-uri.c | 22 +++++++++++++++++++++-
> t/t5750-bundle-uri-parse.sh | 26 ++++++++++++++++++++++++++
> 2 files changed, 47 insertions(+), 1 deletion(-)
>
> diff --git a/bundle-uri.c b/bundle-uri.c
> index 57cccfc6b8..022e2109a6 100644
> --- a/bundle-uri.c
> +++ b/bundle-uri.c
> @@ -89,7 +89,8 @@ static int summarize_bundle(struct remote_bundle_info *info, void *data)
> {
> FILE *fp = data;
> fprintf(fp, "[bundle \"%s\"]\n", info->id);
> - fprintf(fp, "\turi = %s\n", info->uri);
> + if (info->uri)
> + fprintf(fp, "\turi = %s\n", info->uri);
All the other code paths error out when info->uri is missing; I can
understand that print_bundle_list() want to keep going as it is
primarily for debugging, but then don't we want to more loudly
report that a mandatory thing info->uri is missing, rather than a
subtle hint that is lack of expected line that shows "uri = ..."? |
Good point, I'll update it to print |
When a bundle list config file has a typo like 'url' instead of 'uri', or simply omits the uri field, the bundle entry is created but bundle->uri remains NULL. This causes a segfault when copy_uri_to_file() passes the NULL to starts_with(). Signed-off-by: Sam Bostock <[email protected]>
3d8a014 to
fb66352
Compare
|
/submit |
|
Submitted as [email protected] To fetch this version into To fetch this version to local tag |
Changes since v1:
summarize_bundle()to print# uri = (missing)as acomment instead of silently omitting the line.