From: "Marco Costalba" <mcostalba@gmail.com>
To: "Junio C Hamano" <gitster@pobox.com>
Cc: "Git Mailing List" <git@vger.kernel.org>
Subject: [PATCH] Fix an off by one bug in pretty.c
Date: Sat, 5 Jan 2008 23:55:37 +0100 [thread overview]
Message-ID: <e5bfff550801051455i3d589c4q9375aeab0cb6aa47@mail.gmail.com> (raw)
In case author email is <> then we have the following
bug in function 'format_person_part'
/* parse name */
for (end = 0; end < len && msg[end] != '<'; end++)
; /* do nothing */
start = end + 1; /* now start points to '>' */
-- cut ---
/* parse email */
for (end = start + 1; end < len && msg[end] != '>'; end++)
And here 'end' is initialized with 'start + 1'
instead of 'start'. This turns out in empty commit
date when git log is used with --pretty=format option.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
---
pretty.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/pretty.c b/pretty.c
index 5b1078b..0b2f187 100644
--- a/pretty.c
+++ b/pretty.c
@@ -292,7 +292,7 @@ static void format_person_part
/* parse name */
for (end = 0; end < len && msg[end] != '<'; end++)
; /* do nothing */
- start = end + 1;
+ start = end;
while (end > 0 && isspace(msg[end - 1]))
end--;
if (part == 'n') { /* name */
--
1.5.4.rc2.38.gd6da3-dirty
next reply other threads:[~2008-01-05 22:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-05 22:55 Marco Costalba [this message]
2008-01-05 23:18 ` [PATCH] Fix an off by one bug in pretty.c Marco Costalba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e5bfff550801051455i3d589c4q9375aeab0cb6aa47@mail.gmail.com \
--to=mcostalba@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).