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
This commit is contained in:
commit
d37e8c54a6
@ -334,7 +334,7 @@ static int check_header(const struct strbuf *line,
|
|||||||
}
|
}
|
||||||
if (starts_with(line->buf, "[PATCH]") && isspace(line->buf[7])) {
|
if (starts_with(line->buf, "[PATCH]") && isspace(line->buf[7])) {
|
||||||
for (i = 0; header[i]; i++) {
|
for (i = 0; header[i]; i++) {
|
||||||
if (!memcmp("Subject", header[i], 7)) {
|
if (!strcmp("Subject", header[i])) {
|
||||||
handle_header(&hdr_data[i], line);
|
handle_header(&hdr_data[i], line);
|
||||||
ret = 1;
|
ret = 1;
|
||||||
goto check_header_out;
|
goto check_header_out;
|
||||||
@ -929,13 +929,13 @@ static void handle_info(void)
|
|||||||
else
|
else
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!memcmp(header[i], "Subject", 7)) {
|
if (!strcmp(header[i], "Subject")) {
|
||||||
if (!keep_subject) {
|
if (!keep_subject) {
|
||||||
cleanup_subject(hdr);
|
cleanup_subject(hdr);
|
||||||
cleanup_space(hdr);
|
cleanup_space(hdr);
|
||||||
}
|
}
|
||||||
output_header_lines(fout, "Subject", hdr);
|
output_header_lines(fout, "Subject", hdr);
|
||||||
} else if (!memcmp(header[i], "From", 4)) {
|
} else if (!strcmp(header[i], "From")) {
|
||||||
cleanup_space(hdr);
|
cleanup_space(hdr);
|
||||||
handle_from(hdr);
|
handle_from(hdr);
|
||||||
fprintf(fout, "Author: %s\n", name.buf);
|
fprintf(fout, "Author: %s\n", name.buf);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user