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)
git_buf buf = GIT_BUF_INIT;
size_t j, pos;
git_remote_head key;
git_refspec *cur;
const char* formatters[] = {
GIT_REFS_DIR "%s",
......@@ -312,7 +313,9 @@ int git_refspec__dwim_one(git_vector *out, git_refspec *spec, git_vector *refs)
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);
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