Code

builtin-apply: fix typo leading to stack corruption
authorImre Deak <imre.deak@gmail.com>
Wed, 8 Oct 2008 21:24:16 +0000 (00:24 +0300)
committerShawn O. Pearce <spearce@spearce.org>
Thu, 9 Oct 2008 16:21:50 +0000 (09:21 -0700)
This typo led to stack corruption for lines with whitespace fixes
and length > 1024.

Signed-off-by: Imre Deak <imre.deak@gmail.com>
Looks-good-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
builtin-apply.c

index 2c87cf57fde83117193fad196c7f1023dcea7525..74f7e79241b1f8192ad00af39571ef59a796b8af 100644 (file)
@@ -1697,7 +1697,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);