зеркало из https://github.com/microsoft/git.git
Merge branch 'js/sign-empty-commit-fix' into maint
"git commit --amend --allow-empty-message -S" for a commit without any message body could have misidentified where the header of the commit object ends. * js/sign-empty-commit-fix: commit -S: avoid invalid pointer with empty message
This commit is contained in:
Коммит
475495ff5e
7
commit.c
7
commit.c
|
@ -1092,9 +1092,14 @@ static int do_sign_commit(struct strbuf *buf, const char *keyid)
|
||||||
{
|
{
|
||||||
struct strbuf sig = STRBUF_INIT;
|
struct strbuf sig = STRBUF_INIT;
|
||||||
int inspos, copypos;
|
int inspos, copypos;
|
||||||
|
const char *eoh;
|
||||||
|
|
||||||
/* find the end of the header */
|
/* find the end of the header */
|
||||||
inspos = strstr(buf->buf, "\n\n") - buf->buf + 1;
|
eoh = strstr(buf->buf, "\n\n");
|
||||||
|
if (!eoh)
|
||||||
|
inspos = buf->len;
|
||||||
|
else
|
||||||
|
inspos = eoh - buf->buf + 1;
|
||||||
|
|
||||||
if (!keyid || !*keyid)
|
if (!keyid || !*keyid)
|
||||||
keyid = get_signing_key();
|
keyid = get_signing_key();
|
||||||
|
|
Загрузка…
Ссылка в новой задаче