threads / patch / 15827

patchbuiltin-apply: fix typo leading to stack corruption

Subject: [PATCH] builtin-apply: fix typo leading to stack corruption

## tl;dr

5 messages between Oct 8, 2008 and Oct 9, 2008. Diffs are folded; open one to read it.

replies: 4people: 4as markdown or json

Imre Deak· Oct 8, 2008, 21:24 UTC · lore
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(-)
Show changes to builtin-apply.c +1 −1
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
Shawn O. Pearce· Oct 9, 2008, 16:04 UTC · re: Junio C Hamano · lore

Re: [PATCH] builtin-apply: fix typo leading to stack corruption

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.
Brandon Casey· Oct 9, 2008, 16:07 UTC · re: Shawn O. Pearce · lore

Re: [PATCH] builtin-apply: fix typo leading to stack corruption

Shawn O. Pearce wrote:
Show 6 quoted lines
> 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
Shawn O. Pearce· Oct 9, 2008, 16:12 UTC · re: Brandon Casey · lore

Re: [PATCH] builtin-apply: fix typo leading to stack corruption

Brandon Casey <casey@nrlssc.navy.mil> wrote:
Show 9 quoted lines
> 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.

← back to recent threads