Commit 592b200c by Etienne Samson

refspec: check for valid parameters in git_refspec__dwim_one

CID:1383993, "In git_refspec__dwim_one: All paths that lead to this null pointer comparison already dereference the pointer earlier (CWE-476)"
parent d906a879
...@@ -304,6 +304,7 @@ int git_refspec__dwim_one(git_vector *out, git_refspec *spec, git_vector *refs) ...@@ -304,6 +304,7 @@ int git_refspec__dwim_one(git_vector *out, git_refspec *spec, git_vector *refs)
git_buf buf = GIT_BUF_INIT; git_buf buf = GIT_BUF_INIT;
size_t j, pos; size_t j, pos;
git_remote_head key; git_remote_head key;
git_refspec *cur;
const char* formatters[] = { const char* formatters[] = {
GIT_REFS_DIR "%s", GIT_REFS_DIR "%s",
...@@ -312,7 +313,9 @@ int git_refspec__dwim_one(git_vector *out, git_refspec *spec, git_vector *refs) ...@@ -312,7 +313,9 @@ int git_refspec__dwim_one(git_vector *out, git_refspec *spec, git_vector *refs)
NULL NULL
}; };
git_refspec *cur = git__calloc(1, sizeof(git_refspec)); assert(out && spec && refs);
cur = git__calloc(1, sizeof(git_refspec));
GITERR_CHECK_ALLOC(cur); GITERR_CHECK_ALLOC(cur);
cur->force = spec->force; cur->force = spec->force;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment