Merge pull request #3428 from ethomson/clone_test_buffer Clone test buffer
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
diff --git a/tests/clar_libgit2.c b/tests/clar_libgit2.c
index cc687ba..61442f8 100644
--- a/tests/clar_libgit2.c
+++ b/tests/clar_libgit2.c
@@ -299,6 +299,8 @@ const char* cl_git_path_url(const char *path)
in_buf++;
}
+ cl_assert(url_buf.size < 4096);
+
strncpy(url, git_buf_cstr(&url_buf), 4096);
git_buf_free(&url_buf);
git_buf_free(&path_buf);
diff --git a/tests/clone/nonetwork.c b/tests/clone/nonetwork.c
index 44a5038..7ebf19f 100644
--- a/tests/clone/nonetwork.c
+++ b/tests/clone/nonetwork.c
@@ -297,16 +297,19 @@ static void assert_correct_reflog(const char *name)
{
git_reflog *log;
const git_reflog_entry *entry;
- char expected_log_message[128] = {0};
+ git_buf expected_message = GIT_BUF_INIT;
- sprintf(expected_log_message, "clone: from %s", cl_git_fixture_url("testrepo.git"));
+ git_buf_printf(&expected_message,
+ "clone: from %s", cl_git_fixture_url("testrepo.git"));
cl_git_pass(git_reflog_read(&log, g_repo, name));
cl_assert_equal_i(1, git_reflog_entrycount(log));
entry = git_reflog_entry_byindex(log, 0);
- cl_assert_equal_s(expected_log_message, git_reflog_entry_message(entry));
+ cl_assert_equal_s(expected_message.ptr, git_reflog_entry_message(entry));
git_reflog_free(log);
+
+ git_buf_free(&expected_message);
}
void test_clone_nonetwork__clone_updates_reflog_properly(void)