From: Johan Herland <johan@herland.net>
To: Johannes Sixt <j.sixt@viscovery.net>
Cc: Junio C Hamano <gitster@pobox.com>,
git@vger.kernel.org, Peter Krefting <peter@softwolves.pp.se>,
"Shawn O. Pearce" <spearce@spearce.org>
Subject: Re: [PATCH] quickfetch(): Prevent overflow of the rev-list command line
Date: Wed, 8 Jul 2009 18:01:36 +0200 [thread overview]
Message-ID: <200907081801.36901.johan@herland.net> (raw)
In-Reply-To: <4A54B755.4090100@viscovery.net>
On Wednesday 08 July 2009, Johannes Sixt wrote:
> Johan Herland schrieb:
> > + /* If rev-list --stdin encounters an unknown commit, it
> > terminates, + * which will cause SIGPIPE in the write loop below.
> > */
>
> Under the conditions you describe here...
>
> > + signal(SIGPIPE, SIG_IGN);
>
> ... and SIGPIPE being ignored...
>
> > +
> > + err = start_command(&revlist);
> > + if (err) {
> > + error("could not run rev-list");
> > + return err;
> > + }
> >
> > - for (i = 0; argv[i]; i++)
> > - free(argv[i]);
> > - free(argv);
> > - return err;
> > + for (ref = ref_map; ref; ref = ref->next) {
> > + if (write_in_full(revlist.in, sha1_to_hex(ref->old_sha1), 40) <
> > 0 || + write_in_full(revlist.in, "\n", 1) < 0) {
> > + error("failed write to rev-list");
> > + err = errno;
>
> ... don't you get this error message with errno set to EPIPE?
> Previously, there was no error message.
Indeed, you are correct. I guess the following should be added to the
patch:
if (write_in_full(revlist.in, sha1_to_hex(ref->old_sha1), 40) < 0 ||
write_in_full(revlist.in, "\n", 1) < 0) {
- error("failed write to rev-list");
- err = errno;
+ if (errno != EPIPE) {
+ error("failed write to rev-list");
+ err = errno;
+ }
break;
}
Maybe I need to do something to the close() call as well? What happens on close() after EPIPE?
Thanks,
...Johan
--
Johan Herland, <johan@herland.net>
www.herland.net
next prev parent reply other threads:[~2009-07-08 16:02 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-18 13:10 msysgit git-submodule: "Unable to fetch in submodule path ..." Peter Krefting
2009-06-22 12:46 ` Peter Krefting
2009-07-08 13:58 ` [PATCH] quickfetch(): Prevent overflow of the rev-list command line Johan Herland
2009-07-08 15:12 ` Johannes Sixt
2009-07-08 16:01 ` Johan Herland [this message]
2009-07-08 17:22 ` Junio C Hamano
2009-07-09 8:43 ` Johan Herland
2009-07-09 8:49 ` Alex Riesen
2009-07-09 8:51 ` Johannes Sixt
2009-07-09 9:07 ` Johan Herland
2009-07-09 9:15 ` Johannes Sixt
2009-07-09 9:34 ` Johan Herland
2009-07-09 12:22 ` Johannes Sixt
2009-07-09 13:52 ` [PATCH v3] " Johan Herland
2009-07-09 14:21 ` Johannes Sixt
2009-07-09 14:32 ` Jeff King
2009-07-09 14:49 ` [PATCH v4] " Johan Herland
2009-07-09 16:20 ` Johannes Sixt
2009-07-09 23:52 ` [PATCH v5] " Johan Herland
2009-07-11 6:55 ` Junio C Hamano
2009-07-11 10:58 ` Johan Herland
2009-07-09 14:42 ` [PATCH v3] " Johan Herland
2009-07-09 14:56 ` Johannes Sixt
2009-07-09 15:32 ` Johan Herland
2009-07-09 16:14 ` Johannes Sixt
2009-07-09 8:01 ` [PATCH] " Alex Riesen
2009-07-09 8:37 ` Johan Herland
2009-07-09 8:43 ` Alex Riesen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200907081801.36901.johan@herland.net \
--to=johan@herland.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=j.sixt@viscovery.net \
--cc=peter@softwolves.pp.se \
--cc=spearce@spearce.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).