mirror of
https://git.proxmox.com/git/libgit2
synced 2026-01-06 04:46:34 +00:00
notes: Do not assume blob contents are NULL-terminated
This commit is contained in:
parent
72d0024134
commit
1ba48b7caf
@ -313,6 +313,7 @@ static int note_new(
|
||||
git_blob *blob)
|
||||
{
|
||||
git_note *note = NULL;
|
||||
git_buf note_contents = GIT_BUF_INIT;
|
||||
|
||||
note = (git_note *)git__malloc(sizeof(git_note));
|
||||
GITERR_CHECK_ALLOC(note);
|
||||
@ -323,11 +324,10 @@ static int note_new(
|
||||
git_signature_dup(¬e->committer, git_commit_committer(commit)) < 0)
|
||||
return -1;
|
||||
|
||||
note->message = git__strdup((char *)git_blob_rawcontent(blob));
|
||||
GITERR_CHECK_ALLOC(note->message);
|
||||
git_buf_put(¬e_contents, git_blob_rawcontent(blob), git_blob_rawsize(blob));
|
||||
note->message = git_buf_detach(¬e_contents);
|
||||
|
||||
*out = note;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user