summaryrefslogtreecommitdiff
path: root/builtin/mailinfo.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-06-09 11:27:53 -0700
committerJunio C Hamano <gitster@pobox.com>2014-06-09 11:27:53 -0700
commitd37e8c54a60c4aa92e1bb412b416ca1fea821587 (patch)
tree55d237cf596ab4a6360b42207cabdca27413a9dd /builtin/mailinfo.c
parent53b4d8387bb75a9b84ef67a72dc4e1587dbb6192 (diff)
parentb1a013dd6a79826675138cf9bdfaf18fafa786ba (diff)
downloadgit-d37e8c54a60c4aa92e1bb412b416ca1fea821587.tar.gz
Merge branch 'rs/mailinfo-header-cmp'
Avoid running over the end of header string while parsing an incoming e-mail message to extract the patch. * rs/mailinfo-header-cmp: mailinfo: use strcmp() for string comparison
Diffstat (limited to 'builtin/mailinfo.c')
-rw-r--r--builtin/mailinfo.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/builtin/mailinfo.c b/builtin/mailinfo.c
index 2c3cd8eab7..cf11c8d607 100644
--- a/builtin/mailinfo.c
+++ b/builtin/mailinfo.c
@@ -334,7 +334,7 @@ static int check_header(const struct strbuf *line,
}
if (starts_with(line->buf, "[PATCH]") && isspace(line->buf[7])) {
for (i = 0; header[i]; i++) {
- if (!memcmp("Subject", header[i], 7)) {
+ if (!strcmp("Subject", header[i])) {
handle_header(&hdr_data[i], line);
ret = 1;
goto check_header_out;
@@ -929,13 +929,13 @@ static void handle_info(void)
else
continue;
- if (!memcmp(header[i], "Subject", 7)) {
+ if (!strcmp(header[i], "Subject")) {
if (!keep_subject) {
cleanup_subject(hdr);
cleanup_space(hdr);
}
output_header_lines(fout, "Subject", hdr);
- } else if (!memcmp(header[i], "From", 4)) {
+ } else if (!strcmp(header[i], "From")) {
cleanup_space(hdr);
handle_from(hdr);
fprintf(fout, "Author: %s\n", name.buf);