From bf804d407e8d1fcff42e1113aa286270ae8925c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Thu, 17 Mar 2016 10:45:22 +0100 Subject: commit: fix extraction of single-line signatures The function to extract signatures suffers from a similar bug to the header field finding one by having an unecessary line feed check as a break condition of its loop. Fix that and add a test for this single-line signature situation. --- src/commit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/commit.c') diff --git a/src/commit.c b/src/commit.c index 9d675ac97..905407aac 100644 --- a/src/commit.c +++ b/src/commit.c @@ -726,7 +726,7 @@ int git_commit_extract_signature(git_buf *signature, git_buf *signed_data, git_r buf = git_odb_object_data(obj); - while ((h = strchr(buf, '\n')) && h[1] != '\0' && h[1] != '\n') { + while ((h = strchr(buf, '\n')) && h[1] != '\0') { h++; if (git__prefixcmp(buf, field)) { if (git_buf_put(signed_data, buf, h - buf) < 0) -- cgit v1.2.1