mailinfo: off-by-one fix for [PATCH (foobar)] removal from Subject: line
A patch title "[PATCH] 1" was sanitized by the original code by stripping the "[PATCH]" from the front, but after the conversion to use strbuf this behaviour was broken due to a counting error. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Jul 16, 2008 at 22:42 UTC
1e102bf7c83281944ffd9202a7d35c514e4a5644
1 file changed
+3
-4
builtin-mailinfo.c
+3
-4
@@ -225,10 +225,9 @@ static void cleanup_subject(struct strbuf *subject)
225
continue;
226
case '[':
227
if ((pos = strchr(subject->buf, ']'))) {
228
- remove = pos - subject->buf + 1;
229
- /* Don't remove too much. */
230
- if (remove <= (subject->len - remove + 1) * 2) {
231
- strbuf_remove(subject, 0, remove);
228
+ remove = pos - subject->buf;
229
+ if (remove <= (subject->len - remove) * 2) {
230
+ strbuf_remove(subject, 0, remove + 1);
231
continue;
232
}
233
} else