git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] builtin-apply: fix typo leading to stack corruption
@ 2008-10-08 21:24 Imre Deak
  2008-10-09 12:51 ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Imre Deak @ 2008-10-08 21:24 UTC (permalink / raw)
  To: git

This typo led to stack corruption for lines with whitespace fixes
and length > 1024.
---
 builtin-apply.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/builtin-apply.c b/builtin-apply.c
index 20bef1f..720dc7f 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -1696,7 +1696,7 @@ static int match_fragment(struct image *img,
 		fixlen = ws_fix_copy(buf, orig, oldlen, ws_rule, NULL);
 
 		/* Try fixing the line in the target */
-		if (sizeof(tgtfixbuf) < tgtlen)
+		if (sizeof(tgtfixbuf) > tgtlen)
 			tgtfix = tgtfixbuf;
 		else
 			tgtfix = xmalloc(tgtlen);
-- 
1.6.0.2.308.g754c

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] builtin-apply: fix typo leading to stack corruption
@ 2008-10-08 21:24 Imre Deak
  0 siblings, 0 replies; 6+ messages in thread
From: Imre Deak @ 2008-10-08 21:24 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

This typo led to stack corruption for lines > 1024 if whitespace fixing
is in effect.

Signed-off-by: Imre Deak <imre.deak@gmail.com>

---
 builtin-apply.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/builtin-apply.c b/builtin-apply.c
index 20bef1f..720dc7f 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -1696,7 +1696,7 @@ static int match_fragment(struct image *img,
 		fixlen = ws_fix_copy(buf, orig, oldlen, ws_rule, NULL);
 
 		/* Try fixing the line in the target */
-		if (sizeof(tgtfixbuf) < tgtlen)
+		if (sizeof(tgtfixbuf) > tgtlen)
 			tgtfix = tgtfixbuf;
 		else
 			tgtfix = xmalloc(tgtlen);
-- 
1.6.0.2.308.g754c

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] builtin-apply: fix typo leading to stack corruption
  2008-10-08 21:24 [PATCH] builtin-apply: fix typo leading to stack corruption Imre Deak
@ 2008-10-09 12:51 ` Junio C Hamano
  2008-10-09 16:04   ` Shawn O. Pearce
  0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2008-10-09 12:51 UTC (permalink / raw)
  To: Imre Deak; +Cc: git

Looks good and would look better with a sign-off.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] builtin-apply: fix typo leading to stack corruption
  2008-10-09 12:51 ` Junio C Hamano
@ 2008-10-09 16:04   ` Shawn O. Pearce
  2008-10-09 16:07     ` Brandon Casey
  0 siblings, 1 reply; 6+ messages in thread
From: Shawn O. Pearce @ 2008-10-09 16:04 UTC (permalink / raw)
  To: Imre Deak; +Cc: Junio C Hamano, git

Junio C Hamano <gitster@pobox.com> wrote:
> Looks good and would look better with a sign-off.

I'm holding off on applying this change for a little, hoping Imre
can give us a sign off, but really I don't think anyone can claim
copyright to the < sign.  If they can, we're in big trouble.  :-)

-- 
Shawn.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] builtin-apply: fix typo leading to stack corruption
  2008-10-09 16:04   ` Shawn O. Pearce
@ 2008-10-09 16:07     ` Brandon Casey
  2008-10-09 16:12       ` Shawn O. Pearce
  0 siblings, 1 reply; 6+ messages in thread
From: Brandon Casey @ 2008-10-09 16:07 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: Imre Deak, Junio C Hamano, git

Shawn O. Pearce wrote:
> Junio C Hamano <gitster@pobox.com> wrote:
>> Looks good and would look better with a sign-off.
> 
> I'm holding off on applying this change for a little, hoping Imre
> can give us a sign off, but really I don't think anyone can claim
> copyright to the < sign.  If they can, we're in big trouble.  :-)

You must have missed 48ee0b28.04eb300a.03f6.fffffe21@mx.google.com

-b

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] builtin-apply: fix typo leading to stack corruption
  2008-10-09 16:07     ` Brandon Casey
@ 2008-10-09 16:12       ` Shawn O. Pearce
  0 siblings, 0 replies; 6+ messages in thread
From: Shawn O. Pearce @ 2008-10-09 16:12 UTC (permalink / raw)
  To: Brandon Casey; +Cc: Imre Deak, Junio C Hamano, git

Brandon Casey <casey@nrlssc.navy.mil> wrote:
> Shawn O. Pearce wrote:
> > Junio C Hamano <gitster@pobox.com> wrote:
> >> Looks good and would look better with a sign-off.
> > 
> > I'm holding off on applying this change for a little, hoping Imre
> > can give us a sign off, but really I don't think anyone can claim
> > copyright to the < sign.  If they can, we're in big trouble.  :-)
> 
> You must have missed 48ee0b28.04eb300a.03f6.fffffe21@mx.google.com

Yes, I did.  So did gmane, but marc has it.  Thanks.

-- 
Shawn.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-10-09 16:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-08 21:24 [PATCH] builtin-apply: fix typo leading to stack corruption Imre Deak
2008-10-09 12:51 ` Junio C Hamano
2008-10-09 16:04   ` Shawn O. Pearce
2008-10-09 16:07     ` Brandon Casey
2008-10-09 16:12       ` Shawn O. Pearce
  -- strict thread matches above, loose matches on Subject: below --
2008-10-08 21:24 Imre Deak

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).