diff --git a/rebase.go b/rebase.go index 0fd05dd..881c836 100644 --- a/rebase.go +++ b/rebase.go @@ -3,6 +3,7 @@ package git /* #include +extern void _go_git_buf_fill_null(git_buf *buf); extern void _go_git_populate_commit_sign_cb(git_rebase_options *opts); */ import "C" @@ -102,6 +103,8 @@ func commitSignCallback(_signature *C.git_buf, _signature_field *C.git_buf, _com return errors.New("could not grow buffer") } + C._go_git_buf_fill_null(buf) + if int(C.git_buf_set(buf, cstr, clen)) != 0 { return errors.New("could not set buffer") } diff --git a/wrapper.c b/wrapper.c index 90bcf6b..ddb4126 100644 --- a/wrapper.c +++ b/wrapper.c @@ -6,6 +6,11 @@ typedef int (*gogit_submodule_cbk)(git_submodule *sm, const char *name, void *payload); +void _go_git_buf_fill_null(git_buf *buf) +{ + memset(buf->ptr, '\0', buf->asize*sizeof(char)); +} + void _go_git_populate_commit_sign_cb(git_rebase_options *opts) { opts->signing_cb = (git_commit_signing_cb)commitSignCallback;