diff options
author | Vicent Marti <tanoku@gmail.com> | 2014-11-21 17:19:41 +0100 |
---|---|---|
committer | Vicent Marti <tanoku@gmail.com> | 2014-11-21 17:21:34 +0100 |
commit | 1ba48b7caf8e2de010b8c0038860b90be0692274 (patch) | |
tree | 4c017553ce8519c4fe3158c101027856ebae31c0 /src | |
parent | 72d0024134a532374e7fa17ae9e5b6b021ffe324 (diff) | |
download | libgit2-1ba48b7caf8e2de010b8c0038860b90be0692274.tar.gz |
notes: Do not assume blob contents are NULL-terminated
Diffstat (limited to 'src')
-rw-r--r-- | src/notes.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/notes.c b/src/notes.c index 046a91614..9b0d4d5ac 100644 --- a/src/notes.c +++ b/src/notes.c @@ -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; } |