Skip to content

Commit ed5d0d2

Browse files
committed
Merge branch 'rs/mailinfo-header-cmp' into maint
"git mailinfo" used to read beyond 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
2 parents 182c3d6 + b1a013d commit ed5d0d2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

builtin/mailinfo.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ static int check_header(const struct strbuf *line,
334334
}
335335
if (starts_with(line->buf, "[PATCH]") && isspace(line->buf[7])) {
336336
for (i = 0; header[i]; i++) {
337-
if (!memcmp("Subject", header[i], 7)) {
337+
if (!strcmp("Subject", header[i])) {
338338
handle_header(&hdr_data[i], line);
339339
ret = 1;
340340
goto check_header_out;
@@ -929,13 +929,13 @@ static void handle_info(void)
929929
else
930930
continue;
931931

932-
if (!memcmp(header[i], "Subject", 7)) {
932+
if (!strcmp(header[i], "Subject")) {
933933
if (!keep_subject) {
934934
cleanup_subject(hdr);
935935
cleanup_space(hdr);
936936
}
937937
output_header_lines(fout, "Subject", hdr);
938-
} else if (!memcmp(header[i], "From", 4)) {
938+
} else if (!strcmp(header[i], "From")) {
939939
cleanup_space(hdr);
940940
handle_from(hdr);
941941
fprintf(fout, "Author: %s\n", name.buf);

0 commit comments

Comments
 (0)