Manually zero out buffer after reallocing it in rebase
This commit is contained in:
parent
0c942dbd89
commit
a94318f919
|
@ -3,6 +3,7 @@ package git
|
||||||
/*
|
/*
|
||||||
#include <git2.h>
|
#include <git2.h>
|
||||||
|
|
||||||
|
extern void _go_git_buf_fill_null(git_buf *buf);
|
||||||
extern void _go_git_populate_commit_sign_cb(git_rebase_options *opts);
|
extern void _go_git_populate_commit_sign_cb(git_rebase_options *opts);
|
||||||
*/
|
*/
|
||||||
import "C"
|
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")
|
return errors.New("could not grow buffer")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
C._go_git_buf_fill_null(buf)
|
||||||
|
|
||||||
if int(C.git_buf_set(buf, cstr, clen)) != 0 {
|
if int(C.git_buf_set(buf, cstr, clen)) != 0 {
|
||||||
return errors.New("could not set buffer")
|
return errors.New("could not set buffer")
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,11 @@
|
||||||
|
|
||||||
typedef int (*gogit_submodule_cbk)(git_submodule *sm, const char *name, void *payload);
|
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)
|
void _go_git_populate_commit_sign_cb(git_rebase_options *opts)
|
||||||
{
|
{
|
||||||
opts->signing_cb = (git_commit_signing_cb)commitSignCallback;
|
opts->signing_cb = (git_commit_signing_cb)commitSignCallback;
|
||||||
|
|
Loading…
Reference in New Issue