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

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