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

5 messages from 2008-10-08 to 2008-10-09. Participants: Imre Deak, Junio C Hamano, Shawn O. Pearce, Brandon Casey.
Thread: https://gitlist.dev/t/15827

## Imre Deak, 2008-10-08 21:24

Subject: [PATCH] builtin-apply: fix typo leading to stack corruption
Message-ID: <48ed30f5.0707d00a.2994.6f1e@mx.google.com>
URL: https://gitlist.dev/e/48ed30f5.0707d00a.2994.6f1e%40mx.google.com

```
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

```

## Junio C Hamano, 2008-10-09 12:51

Subject: Re: [PATCH] builtin-apply: fix typo leading to stack corruption
Message-ID: <7v4p3mors6.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7v4p3mors6.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <48ed30f5.0707d00a.2994.6f1e@mx.google.com>

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

```

## Shawn O. Pearce, 2008-10-09 16:04

Subject: Re: [PATCH] builtin-apply: fix typo leading to stack corruption
Message-ID: <20081009160428.GB29829@spearce.org>
URL: https://gitlist.dev/e/20081009160428.GB29829%40spearce.org
In-Reply-To: <7v4p3mors6.fsf@gitster.siamese.dyndns.org>

```
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, 2008-10-09 16:07

Subject: Re: [PATCH] builtin-apply: fix typo leading to stack corruption
Message-ID: <jYNqXNcmiUXkVpg8nytGwxXfAQx2H1W9kx59NrgLLGIbPFpol_FZVQ@cipher.nrlssc.navy.mil>
URL: https://gitlist.dev/e/jYNqXNcmiUXkVpg8nytGwxXfAQx2H1W9kx59NrgLLGIbPFpol_FZVQ%40cipher.nrlssc.navy.mil
In-Reply-To: <20081009160428.GB29829@spearce.org>

```
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

```

## Shawn O. Pearce, 2008-10-09 16:12

Subject: Re: [PATCH] builtin-apply: fix typo leading to stack corruption
Message-ID: <20081009161202.GW8203@spearce.org>
URL: https://gitlist.dev/e/20081009161202.GW8203%40spearce.org
In-Reply-To: <jYNqXNcmiUXkVpg8nytGwxXfAQx2H1W9kx59NrgLLGIbPFpol_FZVQ@cipher.nrlssc.navy.mil>

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

```
