git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@gmail.com>
To: git@vger.kernel.org
Subject: [PATCH] builtin-apply: fix typo leading to stack corruption
Date: Thu, 9 Oct 2008 00:24:16 +0300	[thread overview]
Message-ID: <48ed30f5.0707d00a.2994.6f1e@mx.google.com> (raw)

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

             reply	other threads:[~2008-10-08 22:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-08 21:24 Imre Deak [this message]
2008-10-09 12:51 ` [PATCH] builtin-apply: fix typo leading to stack corruption 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

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=48ed30f5.0707d00a.2994.6f1e@mx.google.com \
    --to=imre.deak@gmail.com \
    --cc=git@vger.kernel.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).