X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin-mailinfo.c;h=b99a5b6f9679061d75e9c48e2fa5877e27920dc3;hb=c47f10246ac6413ac6902bd70e45492174fac873;hp=4b8261552a21d1ff074e10cbcf3d79194c7c8281;hpb=0513f241cc2d757371dc7ba6b065366de044862e;p=git.git diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c index 4b8261552..b99a5b6f9 100644 --- a/builtin-mailinfo.c +++ b/builtin-mailinfo.c @@ -225,10 +225,9 @@ static void cleanup_subject(struct strbuf *subject) continue; case '[': if ((pos = strchr(subject->buf, ']'))) { - remove = pos - subject->buf + 1; - /* Don't remove too much. */ - if (remove <= (subject->len - remove + 1) * 2) { - strbuf_remove(subject, 0, remove); + remove = pos - subject->buf; + if (remove <= (subject->len - remove) * 2) { + strbuf_remove(subject, 0, remove + 1); continue; } } else