public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@gmail•com>
To: git@vger•kernel.org
Cc: Junio C Hamano <gitster@pobox•com>
Subject: [PATCH] builtin-apply: fix typo leading to stack corruption
Date: Thu, 9 Oct 2008 00:24:16 +0300	[thread overview]
Message-ID: <48ee0b28.04eb300a.03f6.fffffe21@mx.google.com> (raw)

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

             reply	other threads:[~2008-10-09 13:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-08 21:24 Imre Deak [this message]
  -- strict thread matches above, loose matches on Subject: below --
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

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=48ee0b28.04eb300a.03f6.fffffe21@mx.google.com \
    --to=imre.deak@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitster@pobox$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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