aboutsummaryrefslogtreecommitdiffstats
path: root/gpg-interface.c
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2021-02-11 02:08:06 +0000
committerJunio C Hamano <gitster@pobox.com>2021-02-10 23:35:42 -0800
commit9b27b49240f6bf760ff58d917491bec0981aaf9f (patch)
tree189bc11259d633e7cd134c02bf0fdb80b7b20e78 /gpg-interface.c
parent88bce0e24c8f777fce1f726b4553bd32286bba04 (diff)
downloadgit-9b27b49240f6bf760ff58d917491bec0981aaf9f.tar.gz
gpg-interface: remove other signature headers before verifying
When we have a multiply signed commit, we need to remove the signature in the header before verifying the object, since the trailing signature will not be over both pieces of data. Do so, and verify that we validate the signature appropriately. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'gpg-interface.c')
-rw-r--r--gpg-interface.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/gpg-interface.c b/gpg-interface.c
index c6274c14af..127aecfc2b 100644
--- a/gpg-interface.c
+++ b/gpg-interface.c
@@ -1,4 +1,5 @@
#include "cache.h"
+#include "commit.h"
#include "config.h"
#include "run-command.h"
#include "strbuf.h"
@@ -366,6 +367,7 @@ int parse_signature(const char *buf, size_t size, struct strbuf *payload, struct
size_t match = parse_signed_buffer(buf, size);
if (match != size) {
strbuf_add(payload, buf, match);
+ remove_signature(payload);
strbuf_add(signature, buf + match, size - match);
return 1;
}