Merge branch 'rs/mailinfo-header-cmp'
authorJunio C Hamano <gitster@pobox.com>
Mon, 9 Jun 2014 18:27:53 +0000 (11:27 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 9 Jun 2014 18:27:53 +0000 (11:27 -0700)
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

1  2 
builtin/mailinfo.c

@@@ -332,9 -332,9 +332,9 @@@ static int check_header(const struct st
                ret = 1; /* Should this return 0? */
                goto check_header_out;
        }
 -      if (!prefixcmp(line->buf, "[PATCH]") && isspace(line->buf[7])) {
 +      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;