Skip to content

Commit f8aae8d

Browse files
Sebastian Göttegitster
authored andcommitted
commit.c/GPG signature verification: Also look at the first GPG status line
Signed-off-by: Sebastian Götte <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ffb6d7d commit f8aae8d

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

commit.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,13 +1054,20 @@ static void parse_gpg_output(struct signature_check *sigc)
10541054
const char *buf = sigc->gpg_status;
10551055
int i;
10561056

1057+
/* Iterate over all search strings */
10571058
for (i = 0; i < ARRAY_SIZE(sigcheck_gpg_status); i++) {
1058-
const char *found = strstr(buf, sigcheck_gpg_status[i].check);
1059-
const char *next;
1060-
if (!found)
1061-
continue;
1059+
const char *found, *next;
1060+
1061+
if (!prefixcmp(buf, sigcheck_gpg_status[i].check + 1)) {
1062+
/* At the very beginning of the buffer */
1063+
found = buf + strlen(sigcheck_gpg_status[i].check + 1);
1064+
} else {
1065+
found = strstr(buf, sigcheck_gpg_status[i].check);
1066+
if (!found)
1067+
continue;
1068+
found += strlen(sigcheck_gpg_status[i].check);
1069+
}
10621070
sigc->result = sigcheck_gpg_status[i].result;
1063-
found += strlen(sigcheck_gpg_status[i].check);
10641071
sigc->key = xmemdupz(found, 16);
10651072
found += 17;
10661073
next = strchrnul(found, '\n');

0 commit comments

Comments
 (0)