threads / patch / 15834

patchbuiltin-apply: fix typo leading to stack corruption

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

## tl;dr

One message between Oct 8, 2008 and Oct 8, 2008. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Imre Deak· Oct 8, 2008, 21:24 UTC · lore

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

← back to recent threads