idx int64 | func_before string | Vulnerability Classification string | vul int64 | func_after string | patch string | CWE ID string | lines_before string | lines_after string |
|---|---|---|---|---|---|---|---|---|
44,100 | char *get_revision_mark(const struct rev_info *revs, const struct commit *commit)
{
if (commit->object.flags & BOUNDARY)
return "-";
else if (commit->object.flags & UNINTERESTING)
return "^";
else if (commit->object.flags & PATCHSAME)
return "=";
else if (!revs || revs->left_right) {
if (commit->object.flag... | Exec Code Overflow | 0 | char *get_revision_mark(const struct rev_info *revs, const struct commit *commit)
{
if (commit->object.flags & BOUNDARY)
return "-";
else if (commit->object.flags & UNINTERESTING)
return "^";
else if (commit->object.flags & PATCHSAME)
return "=";
else if (!revs || revs->left_right) {
if (commit->object.flag... | @@ -25,27 +25,14 @@ volatile show_early_output_fn_t show_early_output;
static const char *term_bad;
static const char *term_good;
-char *path_name(struct strbuf *path, const char *name)
+void show_object_with_name(FILE *out, struct object *obj, const char *name)
{
- struct strbuf ret = STRBUF_INIT;
- if (path)
- ... | CWE-119 | null | null |
44,101 | struct commit_list *get_saved_parents(struct rev_info *revs, const struct commit *commit)
{
struct commit_list *parents;
if (!revs->saved_parents_slab)
return commit->parents;
parents = *saved_parents_at(revs->saved_parents_slab, commit);
if (parents == EMPTY_PARENT_LIST)
return NULL;
return parents;
}
| Exec Code Overflow | 0 | struct commit_list *get_saved_parents(struct rev_info *revs, const struct commit *commit)
{
struct commit_list *parents;
if (!revs->saved_parents_slab)
return commit->parents;
parents = *saved_parents_at(revs->saved_parents_slab, commit);
if (parents == EMPTY_PARENT_LIST)
return NULL;
return parents;
}
| @@ -25,27 +25,14 @@ volatile show_early_output_fn_t show_early_output;
static const char *term_bad;
static const char *term_good;
-char *path_name(struct strbuf *path, const char *name)
+void show_object_with_name(FILE *out, struct object *obj, const char *name)
{
- struct strbuf ret = STRBUF_INIT;
- if (path)
- ... | CWE-119 | null | null |
44,102 | static int handle_one_ref(const char *path, const struct object_id *oid,
int flag, void *cb_data)
{
struct all_refs_cb *cb = cb_data;
struct object *object;
if (ref_excluded(cb->all_revs->ref_excludes, path))
return 0;
object = get_reference(cb->all_revs, path, oid->hash, cb->all_flags);
add_rev_cmdlin... | Exec Code Overflow | 0 | static int handle_one_ref(const char *path, const struct object_id *oid,
int flag, void *cb_data)
{
struct all_refs_cb *cb = cb_data;
struct object *object;
if (ref_excluded(cb->all_revs->ref_excludes, path))
return 0;
object = get_reference(cb->all_revs, path, oid->hash, cb->all_flags);
add_rev_cmdlin... | @@ -25,27 +25,14 @@ volatile show_early_output_fn_t show_early_output;
static const char *term_bad;
static const char *term_good;
-char *path_name(struct strbuf *path, const char *name)
+void show_object_with_name(FILE *out, struct object *obj, const char *name)
{
- struct strbuf ret = STRBUF_INIT;
- if (path)
- ... | CWE-119 | null | null |
44,103 | static int handle_one_reflog(const char *path, const struct object_id *oid,
int flag, void *cb_data)
{
struct all_refs_cb *cb = cb_data;
cb->warned_bad_reflog = 0;
cb->name_for_errormsg = path;
for_each_reflog_ent(path, handle_one_reflog_ent, cb_data);
return 0;
}
| Exec Code Overflow | 0 | static int handle_one_reflog(const char *path, const struct object_id *oid,
int flag, void *cb_data)
{
struct all_refs_cb *cb = cb_data;
cb->warned_bad_reflog = 0;
cb->name_for_errormsg = path;
for_each_reflog_ent(path, handle_one_reflog_ent, cb_data);
return 0;
}
| @@ -25,27 +25,14 @@ volatile show_early_output_fn_t show_early_output;
static const char *term_bad;
static const char *term_good;
-char *path_name(struct strbuf *path, const char *name)
+void show_object_with_name(FILE *out, struct object *obj, const char *name)
{
- struct strbuf ret = STRBUF_INIT;
- if (path)
- ... | CWE-119 | null | null |
44,104 | static void handle_one_reflog_commit(unsigned char *sha1, void *cb_data)
{
struct all_refs_cb *cb = cb_data;
if (!is_null_sha1(sha1)) {
struct object *o = parse_object(sha1);
if (o) {
o->flags |= cb->all_flags;
/* ??? CMDLINEFLAGS ??? */
add_pending_object(cb->all_revs, o, "");
}
else if (!cb->warned... | Exec Code Overflow | 0 | static void handle_one_reflog_commit(unsigned char *sha1, void *cb_data)
{
struct all_refs_cb *cb = cb_data;
if (!is_null_sha1(sha1)) {
struct object *o = parse_object(sha1);
if (o) {
o->flags |= cb->all_flags;
/* ??? CMDLINEFLAGS ??? */
add_pending_object(cb->all_revs, o, "");
}
else if (!cb->warned... | @@ -25,27 +25,14 @@ volatile show_early_output_fn_t show_early_output;
static const char *term_bad;
static const char *term_good;
-char *path_name(struct strbuf *path, const char *name)
+void show_object_with_name(FILE *out, struct object *obj, const char *name)
{
- struct strbuf ret = STRBUF_INIT;
- if (path)
- ... | CWE-119 | null | null |
44,105 | static int handle_one_reflog_ent(unsigned char *osha1, unsigned char *nsha1,
const char *email, unsigned long timestamp, int tz,
const char *message, void *cb_data)
{
handle_one_reflog_commit(osha1, cb_data);
handle_one_reflog_commit(nsha1, cb_data);
return 0;
}
| Exec Code Overflow | 0 | static int handle_one_reflog_ent(unsigned char *osha1, unsigned char *nsha1,
const char *email, unsigned long timestamp, int tz,
const char *message, void *cb_data)
{
handle_one_reflog_commit(osha1, cb_data);
handle_one_reflog_commit(nsha1, cb_data);
return 0;
}
| @@ -25,27 +25,14 @@ volatile show_early_output_fn_t show_early_output;
static const char *term_bad;
static const char *term_good;
-char *path_name(struct strbuf *path, const char *name)
+void show_object_with_name(FILE *out, struct object *obj, const char *name)
{
- struct strbuf ret = STRBUF_INIT;
- if (path)
- ... | CWE-119 | null | null |
44,106 | static void handle_refs(const char *submodule, struct rev_info *revs, unsigned flags,
int (*for_each)(const char *, each_ref_fn, void *))
{
struct all_refs_cb cb;
init_all_refs_cb(&cb, revs, flags);
for_each(submodule, handle_one_ref, &cb);
}
| Exec Code Overflow | 0 | static void handle_refs(const char *submodule, struct rev_info *revs, unsigned flags,
int (*for_each)(const char *, each_ref_fn, void *))
{
struct all_refs_cb cb;
init_all_refs_cb(&cb, revs, flags);
for_each(submodule, handle_one_ref, &cb);
}
| @@ -25,27 +25,14 @@ volatile show_early_output_fn_t show_early_output;
static const char *term_bad;
static const char *term_good;
-char *path_name(struct strbuf *path, const char *name)
+void show_object_with_name(FILE *out, struct object *obj, const char *name)
{
- struct strbuf ret = STRBUF_INIT;
- if (path)
- ... | CWE-119 | null | null |
44,107 | static int handle_revision_opt(struct rev_info *revs, int argc, const char **argv,
int *unkc, const char **unkv)
{
const char *arg = argv[0];
const char *optarg;
int argcount;
/* pseudo revision arguments */
if (!strcmp(arg, "--all") || !strcmp(arg, "--branches") ||
!strcmp(arg, "--tags") || !strcm... | Exec Code Overflow | 0 | static int handle_revision_opt(struct rev_info *revs, int argc, const char **argv,
int *unkc, const char **unkv)
{
const char *arg = argv[0];
const char *optarg;
int argcount;
/* pseudo revision arguments */
if (!strcmp(arg, "--all") || !strcmp(arg, "--branches") ||
!strcmp(arg, "--tags") || !strcm... | @@ -25,27 +25,14 @@ volatile show_early_output_fn_t show_early_output;
static const char *term_bad;
static const char *term_good;
-char *path_name(struct strbuf *path, const char *name)
+void show_object_with_name(FILE *out, struct object *obj, const char *name)
{
- struct strbuf ret = STRBUF_INIT;
- if (path)
- ... | CWE-119 | null | null |
44,108 | static void init_all_refs_cb(struct all_refs_cb *cb, struct rev_info *revs,
unsigned flags)
{
cb->all_revs = revs;
cb->all_flags = flags;
}
| Exec Code Overflow | 0 | static void init_all_refs_cb(struct all_refs_cb *cb, struct rev_info *revs,
unsigned flags)
{
cb->all_revs = revs;
cb->all_flags = flags;
}
| @@ -25,27 +25,14 @@ volatile show_early_output_fn_t show_early_output;
static const char *term_bad;
static const char *term_good;
-char *path_name(struct strbuf *path, const char *name)
+void show_object_with_name(FILE *out, struct object *obj, const char *name)
{
- struct strbuf ret = STRBUF_INIT;
- if (path)
- ... | CWE-119 | null | null |
44,109 | void init_revisions(struct rev_info *revs, const char *prefix)
{
memset(revs, 0, sizeof(*revs));
revs->abbrev = DEFAULT_ABBREV;
revs->ignore_merges = 1;
revs->simplify_history = 1;
DIFF_OPT_SET(&revs->pruning, RECURSIVE);
DIFF_OPT_SET(&revs->pruning, QUICK);
revs->pruning.add_remove = file_add_remove;
revs->pr... | Exec Code Overflow | 0 | void init_revisions(struct rev_info *revs, const char *prefix)
{
memset(revs, 0, sizeof(*revs));
revs->abbrev = DEFAULT_ABBREV;
revs->ignore_merges = 1;
revs->simplify_history = 1;
DIFF_OPT_SET(&revs->pruning, RECURSIVE);
DIFF_OPT_SET(&revs->pruning, QUICK);
revs->pruning.add_remove = file_add_remove;
revs->pr... | @@ -25,27 +25,14 @@ volatile show_early_output_fn_t show_early_output;
static const char *term_bad;
static const char *term_good;
-char *path_name(struct strbuf *path, const char *name)
+void show_object_with_name(FILE *out, struct object *obj, const char *name)
{
- struct strbuf ret = STRBUF_INIT;
- if (path)
- ... | CWE-119 | null | null |
44,110 | static struct treesame_state *initialise_treesame(struct rev_info *revs, struct commit *commit)
{
unsigned n = commit_list_count(commit->parents);
struct treesame_state *st = xcalloc(1, sizeof(*st) + n);
st->nparents = n;
add_decoration(&revs->treesame, &commit->object, st);
return st;
}
| Exec Code Overflow | 0 | static struct treesame_state *initialise_treesame(struct rev_info *revs, struct commit *commit)
{
unsigned n = commit_list_count(commit->parents);
struct treesame_state *st = xcalloc(1, sizeof(*st) + n);
st->nparents = n;
add_decoration(&revs->treesame, &commit->object, st);
return st;
}
| @@ -25,27 +25,14 @@ volatile show_early_output_fn_t show_early_output;
static const char *term_bad;
static const char *term_good;
-char *path_name(struct strbuf *path, const char *name)
+void show_object_with_name(FILE *out, struct object *obj, const char *name)
{
- struct strbuf ret = STRBUF_INIT;
- if (path)
- ... | CWE-119 | null | null |
44,111 | static int leave_one_treesame_to_parent(struct rev_info *revs, struct commit *commit)
{
struct treesame_state *ts = lookup_decoration(&revs->treesame, &commit->object);
struct commit *unmarked = NULL, *marked = NULL;
struct commit_list *p;
unsigned n;
for (p = commit->parents, n = 0; p; p = p->next, n++) {
if (... | Exec Code Overflow | 0 | static int leave_one_treesame_to_parent(struct rev_info *revs, struct commit *commit)
{
struct treesame_state *ts = lookup_decoration(&revs->treesame, &commit->object);
struct commit *unmarked = NULL, *marked = NULL;
struct commit_list *p;
unsigned n;
for (p = commit->parents, n = 0; p; p = p->next, n++) {
if (... | @@ -25,27 +25,14 @@ volatile show_early_output_fn_t show_early_output;
static const char *term_bad;
static const char *term_good;
-char *path_name(struct strbuf *path, const char *name)
+void show_object_with_name(FILE *out, struct object *obj, const char *name)
{
- struct strbuf ret = STRBUF_INIT;
- if (path)
- ... | CWE-119 | null | null |
44,112 | static void limit_left_right(struct commit_list *list, struct rev_info *revs)
{
struct commit_list *p;
for (p = list; p; p = p->next) {
struct commit *commit = p->item;
if (revs->right_only) {
if (commit->object.flags & SYMMETRIC_LEFT)
commit->object.flags |= SHOWN;
} else /* revs->left_only is set */
... | Exec Code Overflow | 0 | static void limit_left_right(struct commit_list *list, struct rev_info *revs)
{
struct commit_list *p;
for (p = list; p; p = p->next) {
struct commit *commit = p->item;
if (revs->right_only) {
if (commit->object.flags & SYMMETRIC_LEFT)
commit->object.flags |= SHOWN;
} else /* revs->left_only is set */
... | @@ -25,27 +25,14 @@ volatile show_early_output_fn_t show_early_output;
static const char *term_bad;
static const char *term_good;
-char *path_name(struct strbuf *path, const char *name)
+void show_object_with_name(FILE *out, struct object *obj, const char *name)
{
- struct strbuf ret = STRBUF_INIT;
- if (path)
- ... | CWE-119 | null | null |
44,113 | static int limit_list(struct rev_info *revs)
{
int slop = SLOP;
unsigned long date = ~0ul;
struct commit_list *list = revs->commits;
struct commit_list *newlist = NULL;
struct commit_list **p = &newlist;
struct commit_list *bottom = NULL;
struct commit *interesting_cache = NULL;
if (revs->ancestry_path) {
bo... | Exec Code Overflow | 0 | static int limit_list(struct rev_info *revs)
{
int slop = SLOP;
unsigned long date = ~0ul;
struct commit_list *list = revs->commits;
struct commit_list *newlist = NULL;
struct commit_list **p = &newlist;
struct commit_list *bottom = NULL;
struct commit *interesting_cache = NULL;
if (revs->ancestry_path) {
bo... | @@ -25,27 +25,14 @@ volatile show_early_output_fn_t show_early_output;
static const char *term_bad;
static const char *term_good;
-char *path_name(struct strbuf *path, const char *name)
+void show_object_with_name(FILE *out, struct object *obj, const char *name)
{
- struct strbuf ret = STRBUF_INIT;
- if (path)
- ... | CWE-119 | null | null |
44,114 | static void limit_to_ancestry(struct commit_list *bottom, struct commit_list *list)
{
struct commit_list *p;
struct commit_list *rlist = NULL;
int made_progress;
/*
* Reverse the list so that it will be likely that we would
* process parents before children.
*/
for (p = list; p; p = p->next)
commit_list_i... | Exec Code Overflow | 0 | static void limit_to_ancestry(struct commit_list *bottom, struct commit_list *list)
{
struct commit_list *p;
struct commit_list *rlist = NULL;
int made_progress;
/*
* Reverse the list so that it will be likely that we would
* process parents before children.
*/
for (p = list; p; p = p->next)
commit_list_i... | @@ -25,27 +25,14 @@ volatile show_early_output_fn_t show_early_output;
static const char *term_bad;
static const char *term_good;
-char *path_name(struct strbuf *path, const char *name)
+void show_object_with_name(FILE *out, struct object *obj, const char *name)
{
- struct strbuf ret = STRBUF_INIT;
- if (path)
- ... | CWE-119 | null | null |
44,115 | static struct merge_simplify_state *locate_simplify_state(struct rev_info *revs, struct commit *commit)
{
struct merge_simplify_state *st;
st = lookup_decoration(&revs->merge_simplification, &commit->object);
if (!st) {
st = xcalloc(1, sizeof(*st));
add_decoration(&revs->merge_simplification, &commit->object, s... | Exec Code Overflow | 0 | static struct merge_simplify_state *locate_simplify_state(struct rev_info *revs, struct commit *commit)
{
struct merge_simplify_state *st;
st = lookup_decoration(&revs->merge_simplification, &commit->object);
if (!st) {
st = xcalloc(1, sizeof(*st));
add_decoration(&revs->merge_simplification, &commit->object, s... | @@ -25,27 +25,14 @@ volatile show_early_output_fn_t show_early_output;
static const char *term_bad;
static const char *term_good;
-char *path_name(struct strbuf *path, const char *name)
+void show_object_with_name(FILE *out, struct object *obj, const char *name)
{
- struct strbuf ret = STRBUF_INIT;
- if (path)
- ... | CWE-119 | null | null |
44,116 | static void mark_blob_uninteresting(struct blob *blob)
{
if (!blob)
return;
if (blob->object.flags & UNINTERESTING)
return;
blob->object.flags |= UNINTERESTING;
}
| Exec Code Overflow | 0 | static void mark_blob_uninteresting(struct blob *blob)
{
if (!blob)
return;
if (blob->object.flags & UNINTERESTING)
return;
blob->object.flags |= UNINTERESTING;
}
| @@ -25,27 +25,14 @@ volatile show_early_output_fn_t show_early_output;
static const char *term_bad;
static const char *term_good;
-char *path_name(struct strbuf *path, const char *name)
+void show_object_with_name(FILE *out, struct object *obj, const char *name)
{
- struct strbuf ret = STRBUF_INIT;
- if (path)
- ... | CWE-119 | null | null |
44,117 | void mark_parents_uninteresting(struct commit *commit)
{
struct commit_list *parents = NULL, *l;
for (l = commit->parents; l; l = l->next)
commit_list_insert(l->item, &parents);
while (parents) {
struct commit *commit = pop_commit(&parents);
while (commit) {
/*
* A missing commit is ok iff its parent... | Exec Code Overflow | 0 | void mark_parents_uninteresting(struct commit *commit)
{
struct commit_list *parents = NULL, *l;
for (l = commit->parents; l; l = l->next)
commit_list_insert(l->item, &parents);
while (parents) {
struct commit *commit = pop_commit(&parents);
while (commit) {
/*
* A missing commit is ok iff its parent... | @@ -25,27 +25,14 @@ volatile show_early_output_fn_t show_early_output;
static const char *term_bad;
static const char *term_good;
-char *path_name(struct strbuf *path, const char *name)
+void show_object_with_name(FILE *out, struct object *obj, const char *name)
{
- struct strbuf ret = STRBUF_INIT;
- if (path)
- ... | CWE-119 | null | null |
44,118 | static int mark_redundant_parents(struct rev_info *revs, struct commit *commit)
{
struct commit_list *h = reduce_heads(commit->parents);
int i = 0, marked = 0;
struct commit_list *po, *pn;
/* Want these for sanity-checking only */
int orig_cnt = commit_list_count(commit->parents);
int cnt = commit_list_count(h);... | Exec Code Overflow | 0 | static int mark_redundant_parents(struct rev_info *revs, struct commit *commit)
{
struct commit_list *h = reduce_heads(commit->parents);
int i = 0, marked = 0;
struct commit_list *po, *pn;
/* Want these for sanity-checking only */
int orig_cnt = commit_list_count(commit->parents);
int cnt = commit_list_count(h);... | @@ -25,27 +25,14 @@ volatile show_early_output_fn_t show_early_output;
static const char *term_bad;
static const char *term_good;
-char *path_name(struct strbuf *path, const char *name)
+void show_object_with_name(FILE *out, struct object *obj, const char *name)
{
- struct strbuf ret = STRBUF_INIT;
- if (path)
- ... | CWE-119 | null | null |
44,119 | static void mark_tree_contents_uninteresting(struct tree *tree)
{
struct tree_desc desc;
struct name_entry entry;
struct object *obj = &tree->object;
if (!has_object_file(&obj->oid))
return;
if (parse_tree(tree) < 0)
die("bad tree %s", oid_to_hex(&obj->oid));
init_tree_desc(&desc, tree->buffer, tree->size);... | Exec Code Overflow | 0 | static void mark_tree_contents_uninteresting(struct tree *tree)
{
struct tree_desc desc;
struct name_entry entry;
struct object *obj = &tree->object;
if (!has_object_file(&obj->oid))
return;
if (parse_tree(tree) < 0)
die("bad tree %s", oid_to_hex(&obj->oid));
init_tree_desc(&desc, tree->buffer, tree->size);... | @@ -25,27 +25,14 @@ volatile show_early_output_fn_t show_early_output;
static const char *term_bad;
static const char *term_good;
-char *path_name(struct strbuf *path, const char *name)
+void show_object_with_name(FILE *out, struct object *obj, const char *name)
{
- struct strbuf ret = STRBUF_INIT;
- if (path)
- ... | CWE-119 | null | null |
44,120 | void mark_tree_uninteresting(struct tree *tree)
{
struct object *obj;
if (!tree)
return;
obj = &tree->object;
if (obj->flags & UNINTERESTING)
return;
obj->flags |= UNINTERESTING;
mark_tree_contents_uninteresting(tree);
}
| Exec Code Overflow | 0 | void mark_tree_uninteresting(struct tree *tree)
{
struct object *obj;
if (!tree)
return;
obj = &tree->object;
if (obj->flags & UNINTERESTING)
return;
obj->flags |= UNINTERESTING;
mark_tree_contents_uninteresting(tree);
}
| @@ -25,27 +25,14 @@ volatile show_early_output_fn_t show_early_output;
static const char *term_bad;
static const char *term_good;
-char *path_name(struct strbuf *path, const char *name)
+void show_object_with_name(FILE *out, struct object *obj, const char *name)
{
- struct strbuf ret = STRBUF_INIT;
- if (path)
- ... | CWE-119 | null | null |
44,121 | static int mark_treesame_root_parents(struct rev_info *revs, struct commit *commit)
{
struct commit_list *p;
int marked = 0;
for (p = commit->parents; p; p = p->next) {
struct commit *parent = p->item;
if (!parent->parents && (parent->object.flags & TREESAME)) {
parent->object.flags |= TMP_MARK;
marked++;... | Exec Code Overflow | 0 | static int mark_treesame_root_parents(struct rev_info *revs, struct commit *commit)
{
struct commit_list *p;
int marked = 0;
for (p = commit->parents; p; p = p->next) {
struct commit *parent = p->item;
if (!parent->parents && (parent->object.flags & TREESAME)) {
parent->object.flags |= TMP_MARK;
marked++;... | @@ -25,27 +25,14 @@ volatile show_early_output_fn_t show_early_output;
static const char *term_bad;
static const char *term_good;
-char *path_name(struct strbuf *path, const char *name)
+void show_object_with_name(FILE *out, struct object *obj, const char *name)
{
- struct strbuf ret = STRBUF_INIT;
- if (path)
- ... | CWE-119 | null | null |
44,122 | static struct commit *one_relevant_parent(const struct rev_info *revs,
struct commit_list *orig)
{
struct commit_list *list = orig;
struct commit *relevant = NULL;
if (!orig)
return NULL;
/*
* For 1-parent commits, or if first-parent-only, then return that
* first parent (even if not "relevant" by th... | Exec Code Overflow | 0 | static struct commit *one_relevant_parent(const struct rev_info *revs,
struct commit_list *orig)
{
struct commit_list *list = orig;
struct commit *relevant = NULL;
if (!orig)
return NULL;
/*
* For 1-parent commits, or if first-parent-only, then return that
* first parent (even if not "relevant" by th... | @@ -25,27 +25,14 @@ volatile show_early_output_fn_t show_early_output;
static const char *term_bad;
static const char *term_good;
-char *path_name(struct strbuf *path, const char *name)
+void show_object_with_name(FILE *out, struct object *obj, const char *name)
{
- struct strbuf ret = STRBUF_INIT;
- if (path)
- ... | CWE-119 | null | null |
44,123 | void parse_revision_opt(struct rev_info *revs, struct parse_opt_ctx_t *ctx,
const struct option *options,
const char * const usagestr[])
{
int n = handle_revision_opt(revs, ctx->argc, ctx->argv,
&ctx->cpidx, ctx->out);
if (n <= 0) {
error("unknown option `%s'", ctx->argv[0]);
usage_with_options(usag... | Exec Code Overflow | 0 | void parse_revision_opt(struct rev_info *revs, struct parse_opt_ctx_t *ctx,
const struct option *options,
const char * const usagestr[])
{
int n = handle_revision_opt(revs, ctx->argc, ctx->argv,
&ctx->cpidx, ctx->out);
if (n <= 0) {
error("unknown option `%s'", ctx->argv[0]);
usage_with_options(usag... | @@ -25,27 +25,14 @@ volatile show_early_output_fn_t show_early_output;
static const char *term_bad;
static const char *term_good;
-char *path_name(struct strbuf *path, const char *name)
+void show_object_with_name(FILE *out, struct object *obj, const char *name)
{
- struct strbuf ret = STRBUF_INIT;
- if (path)
- ... | CWE-119 | null | null |
44,124 | int prepare_revision_walk(struct rev_info *revs)
{
int i;
struct object_array old_pending;
struct commit_list **next = &revs->commits;
memcpy(&old_pending, &revs->pending, sizeof(old_pending));
revs->pending.nr = 0;
revs->pending.alloc = 0;
revs->pending.objects = NULL;
for (i = 0; i < old_pending.nr; i++) {
... | Exec Code Overflow | 0 | int prepare_revision_walk(struct rev_info *revs)
{
int i;
struct object_array old_pending;
struct commit_list **next = &revs->commits;
memcpy(&old_pending, &revs->pending, sizeof(old_pending));
revs->pending.nr = 0;
revs->pending.alloc = 0;
revs->pending.objects = NULL;
for (i = 0; i < old_pending.nr; i++) {
... | @@ -25,27 +25,14 @@ volatile show_early_output_fn_t show_early_output;
static const char *term_bad;
static const char *term_good;
-char *path_name(struct strbuf *path, const char *name)
+void show_object_with_name(FILE *out, struct object *obj, const char *name)
{
- struct strbuf ret = STRBUF_INIT;
- if (path)
- ... | CWE-119 | null | null |
44,125 | static void prepare_show_merge(struct rev_info *revs)
{
struct commit_list *bases;
struct commit *head, *other;
unsigned char sha1[20];
const char **prune = NULL;
int i, prune_num = 1; /* counting terminating NULL */
if (get_sha1("HEAD", sha1))
die("--merge without HEAD?");
head = lookup_commit_or_die(sha1, "... | Exec Code Overflow | 0 | static void prepare_show_merge(struct rev_info *revs)
{
struct commit_list *bases;
struct commit *head, *other;
unsigned char sha1[20];
const char **prune = NULL;
int i, prune_num = 1; /* counting terminating NULL */
if (get_sha1("HEAD", sha1))
die("--merge without HEAD?");
head = lookup_commit_or_die(sha1, "... | @@ -25,27 +25,14 @@ volatile show_early_output_fn_t show_early_output;
static const char *term_bad;
static const char *term_good;
-char *path_name(struct strbuf *path, const char *name)
+void show_object_with_name(FILE *out, struct object *obj, const char *name)
{
- struct strbuf ret = STRBUF_INIT;
- if (path)
- ... | CWE-119 | null | null |
44,126 | void put_revision_mark(const struct rev_info *revs, const struct commit *commit)
{
char *mark = get_revision_mark(revs, commit);
if (!strlen(mark))
return;
fputs(mark, stdout);
putchar(' ');
}
| Exec Code Overflow | 0 | void put_revision_mark(const struct rev_info *revs, const struct commit *commit)
{
char *mark = get_revision_mark(revs, commit);
if (!strlen(mark))
return;
fputs(mark, stdout);
putchar(' ');
}
| @@ -25,27 +25,14 @@ volatile show_early_output_fn_t show_early_output;
static const char *term_bad;
static const char *term_good;
-char *path_name(struct strbuf *path, const char *name)
+void show_object_with_name(FILE *out, struct object *obj, const char *name)
{
- struct strbuf ret = STRBUF_INIT;
- if (path)
- ... | CWE-119 | null | null |
44,127 | static int remove_duplicate_parents(struct rev_info *revs, struct commit *commit)
{
struct treesame_state *ts = lookup_decoration(&revs->treesame, &commit->object);
struct commit_list **pp, *p;
int surviving_parents;
/* Examine existing parents while marking ones we have seen... */
pp = &commit->parents;
survivi... | Exec Code Overflow | 0 | static int remove_duplicate_parents(struct rev_info *revs, struct commit *commit)
{
struct treesame_state *ts = lookup_decoration(&revs->treesame, &commit->object);
struct commit_list **pp, *p;
int surviving_parents;
/* Examine existing parents while marking ones we have seen... */
pp = &commit->parents;
survivi... | @@ -25,27 +25,14 @@ volatile show_early_output_fn_t show_early_output;
static const char *term_bad;
static const char *term_good;
-char *path_name(struct strbuf *path, const char *name)
+void show_object_with_name(FILE *out, struct object *obj, const char *name)
{
- struct strbuf ret = STRBUF_INIT;
- if (path)
- ... | CWE-119 | null | null |
44,128 | void reset_revision_walk(void)
{
clear_object_flags(SEEN | ADDED | SHOWN);
}
| Exec Code Overflow | 0 | void reset_revision_walk(void)
{
clear_object_flags(SEEN | ADDED | SHOWN);
}
| @@ -25,27 +25,14 @@ volatile show_early_output_fn_t show_early_output;
static const char *term_bad;
static const char *term_good;
-char *path_name(struct strbuf *path, const char *name)
+void show_object_with_name(FILE *out, struct object *obj, const char *name)
{
- struct strbuf ret = STRBUF_INIT;
- if (path)
- ... | CWE-119 | null | null |
44,129 | static int rev_compare_tree(struct rev_info *revs,
struct commit *parent, struct commit *commit)
{
struct tree *t1 = parent->tree;
struct tree *t2 = commit->tree;
if (!t1)
return REV_TREE_NEW;
if (!t2)
return REV_TREE_OLD;
if (revs->simplify_by_decoration) {
/*
* If we are simplifying by decorati... | Exec Code Overflow | 0 | static int rev_compare_tree(struct rev_info *revs,
struct commit *parent, struct commit *commit)
{
struct tree *t1 = parent->tree;
struct tree *t2 = commit->tree;
if (!t1)
return REV_TREE_NEW;
if (!t2)
return REV_TREE_OLD;
if (revs->simplify_by_decoration) {
/*
* If we are simplifying by decorati... | @@ -25,27 +25,14 @@ volatile show_early_output_fn_t show_early_output;
static const char *term_bad;
static const char *term_good;
-char *path_name(struct strbuf *path, const char *name)
+void show_object_with_name(FILE *out, struct object *obj, const char *name)
{
- struct strbuf ret = STRBUF_INIT;
- if (path)
- ... | CWE-119 | null | null |
44,130 | static int rev_same_tree_as_empty(struct rev_info *revs, struct commit *commit)
{
int retval;
struct tree *t1 = commit->tree;
if (!t1)
return 0;
tree_difference = REV_TREE_SAME;
DIFF_OPT_CLR(&revs->pruning, HAS_CHANGES);
retval = diff_tree_sha1(NULL, t1->object.oid.hash, "", &revs->pruning);
return retval >... | Exec Code Overflow | 0 | static int rev_same_tree_as_empty(struct rev_info *revs, struct commit *commit)
{
int retval;
struct tree *t1 = commit->tree;
if (!t1)
return 0;
tree_difference = REV_TREE_SAME;
DIFF_OPT_CLR(&revs->pruning, HAS_CHANGES);
retval = diff_tree_sha1(NULL, t1->object.oid.hash, "", &revs->pruning);
return retval >... | @@ -25,27 +25,14 @@ volatile show_early_output_fn_t show_early_output;
static const char *term_bad;
static const char *term_good;
-char *path_name(struct strbuf *path, const char *name)
+void show_object_with_name(FILE *out, struct object *obj, const char *name)
{
- struct strbuf ret = STRBUF_INIT;
- if (path)
- ... | CWE-119 | null | null |
44,131 | static enum rewrite_result rewrite_one(struct rev_info *revs, struct commit **pp)
{
struct commit_list *cache = NULL;
for (;;) {
struct commit *p = *pp;
if (!revs->limited)
if (add_parents_to_list(revs, p, &revs->commits, &cache) < 0)
return rewrite_one_error;
if (p->object.flags & UNINTERESTING)
ret... | Exec Code Overflow | 0 | static enum rewrite_result rewrite_one(struct rev_info *revs, struct commit **pp)
{
struct commit_list *cache = NULL;
for (;;) {
struct commit *p = *pp;
if (!revs->limited)
if (add_parents_to_list(revs, p, &revs->commits, &cache) < 0)
return rewrite_one_error;
if (p->object.flags & UNINTERESTING)
ret... | @@ -25,27 +25,14 @@ volatile show_early_output_fn_t show_early_output;
static const char *term_bad;
static const char *term_good;
-char *path_name(struct strbuf *path, const char *name)
+void show_object_with_name(FILE *out, struct object *obj, const char *name)
{
- struct strbuf ret = STRBUF_INIT;
- if (path)
- ... | CWE-119 | null | null |
44,132 | static void save_parents(struct rev_info *revs, struct commit *commit)
{
struct commit_list **pp;
if (!revs->saved_parents_slab) {
revs->saved_parents_slab = xmalloc(sizeof(struct saved_parents));
init_saved_parents(revs->saved_parents_slab);
}
pp = saved_parents_at(revs->saved_parents_slab, commit);
/*
*... | Exec Code Overflow | 0 | static void save_parents(struct rev_info *revs, struct commit *commit)
{
struct commit_list **pp;
if (!revs->saved_parents_slab) {
revs->saved_parents_slab = xmalloc(sizeof(struct saved_parents));
init_saved_parents(revs->saved_parents_slab);
}
pp = saved_parents_at(revs->saved_parents_slab, commit);
/*
*... | @@ -25,27 +25,14 @@ volatile show_early_output_fn_t show_early_output;
static const char *term_bad;
static const char *term_good;
-char *path_name(struct strbuf *path, const char *name)
+void show_object_with_name(FILE *out, struct object *obj, const char *name)
{
- struct strbuf ret = STRBUF_INIT;
- if (path)
- ... | CWE-119 | null | null |
44,133 | static void set_children(struct rev_info *revs)
{
struct commit_list *l;
for (l = revs->commits; l; l = l->next) {
struct commit *commit = l->item;
struct commit_list *p;
for (p = commit->parents; p; p = p->next)
add_child(revs, p->item, commit);
}
}
| Exec Code Overflow | 0 | static void set_children(struct rev_info *revs)
{
struct commit_list *l;
for (l = revs->commits; l; l = l->next) {
struct commit *commit = l->item;
struct commit_list *p;
for (p = commit->parents; p; p = p->next)
add_child(revs, p->item, commit);
}
}
| @@ -25,27 +25,14 @@ volatile show_early_output_fn_t show_early_output;
static const char *term_bad;
static const char *term_good;
-char *path_name(struct strbuf *path, const char *name)
+void show_object_with_name(FILE *out, struct object *obj, const char *name)
{
- struct strbuf ret = STRBUF_INIT;
- if (path)
- ... | CWE-119 | null | null |
44,134 | int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct setup_revision_opt *opt)
{
int i, flags, left, seen_dashdash, read_from_stdin, got_rev_arg = 0, revarg_opt;
struct cmdline_pathspec prune_data;
const char *submodule = NULL;
memset(&prune_data, 0, sizeof(prune_data));
if (opt)
submod... | Exec Code Overflow | 0 | int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct setup_revision_opt *opt)
{
int i, flags, left, seen_dashdash, read_from_stdin, got_rev_arg = 0, revarg_opt;
struct cmdline_pathspec prune_data;
const char *submodule = NULL;
memset(&prune_data, 0, sizeof(prune_data));
if (opt)
submod... | @@ -25,27 +25,14 @@ volatile show_early_output_fn_t show_early_output;
static const char *term_bad;
static const char *term_good;
-char *path_name(struct strbuf *path, const char *name)
+void show_object_with_name(FILE *out, struct object *obj, const char *name)
{
- struct strbuf ret = STRBUF_INIT;
- if (path)
- ... | CWE-119 | null | null |
44,135 | enum commit_action simplify_commit(struct rev_info *revs, struct commit *commit)
{
enum commit_action action = get_commit_action(revs, commit);
if (action == commit_show &&
!revs->show_all &&
revs->prune && revs->dense && want_ancestry(revs)) {
/*
* --full-diff on simplified parents is no good: it
... | Exec Code Overflow | 0 | enum commit_action simplify_commit(struct rev_info *revs, struct commit *commit)
{
enum commit_action action = get_commit_action(revs, commit);
if (action == commit_show &&
!revs->show_all &&
revs->prune && revs->dense && want_ancestry(revs)) {
/*
* --full-diff on simplified parents is no good: it
... | @@ -25,27 +25,14 @@ volatile show_early_output_fn_t show_early_output;
static const char *term_bad;
static const char *term_good;
-char *path_name(struct strbuf *path, const char *name)
+void show_object_with_name(FILE *out, struct object *obj, const char *name)
{
- struct strbuf ret = STRBUF_INIT;
- if (path)
- ... | CWE-119 | null | null |
44,136 | static void simplify_merges(struct rev_info *revs)
{
struct commit_list *list, *next;
struct commit_list *yet_to_do, **tail;
struct commit *commit;
if (!revs->prune)
return;
/* feed the list reversed */
yet_to_do = NULL;
for (list = revs->commits; list; list = next) {
commit = list->item;
next = list->ne... | Exec Code Overflow | 0 | static void simplify_merges(struct rev_info *revs)
{
struct commit_list *list, *next;
struct commit_list *yet_to_do, **tail;
struct commit *commit;
if (!revs->prune)
return;
/* feed the list reversed */
yet_to_do = NULL;
for (list = revs->commits; list; list = next) {
commit = list->item;
next = list->ne... | @@ -25,27 +25,14 @@ volatile show_early_output_fn_t show_early_output;
static const char *term_bad;
static const char *term_good;
-char *path_name(struct strbuf *path, const char *name)
+void show_object_with_name(FILE *out, struct object *obj, const char *name)
{
- struct strbuf ret = STRBUF_INIT;
- if (path)
- ... | CWE-119 | null | null |
44,137 | static struct commit_list **simplify_one(struct rev_info *revs, struct commit *commit, struct commit_list **tail)
{
struct commit_list *p;
struct commit *parent;
struct merge_simplify_state *st, *pst;
int cnt;
st = locate_simplify_state(revs, commit);
/*
* Have we handled this one?
*/
if (st->simplified)
... | Exec Code Overflow | 0 | static struct commit_list **simplify_one(struct rev_info *revs, struct commit *commit, struct commit_list **tail)
{
struct commit_list *p;
struct commit *parent;
struct merge_simplify_state *st, *pst;
int cnt;
st = locate_simplify_state(revs, commit);
/*
* Have we handled this one?
*/
if (st->simplified)
... | @@ -25,27 +25,14 @@ volatile show_early_output_fn_t show_early_output;
static const char *term_bad;
static const char *term_good;
-char *path_name(struct strbuf *path, const char *name)
+void show_object_with_name(FILE *out, struct object *obj, const char *name)
{
- struct strbuf ret = STRBUF_INIT;
- if (path)
- ... | CWE-119 | null | null |
44,138 | static unsigned update_treesame(struct rev_info *revs, struct commit *commit)
{
if (commit->parents && commit->parents->next) {
unsigned n;
struct treesame_state *st;
struct commit_list *p;
unsigned relevant_parents;
unsigned relevant_change, irrelevant_change;
st = lookup_decoration(&revs->treesame, &com... | Exec Code Overflow | 0 | static unsigned update_treesame(struct rev_info *revs, struct commit *commit)
{
if (commit->parents && commit->parents->next) {
unsigned n;
struct treesame_state *st;
struct commit_list *p;
unsigned relevant_parents;
unsigned relevant_change, irrelevant_change;
st = lookup_decoration(&revs->treesame, &com... | @@ -25,27 +25,14 @@ volatile show_early_output_fn_t show_early_output;
static const char *term_bad;
static const char *term_good;
-char *path_name(struct strbuf *path, const char *name)
+void show_object_with_name(FILE *out, struct object *obj, const char *name)
{
- struct strbuf ret = STRBUF_INIT;
- if (path)
- ... | CWE-119 | null | null |
44,139 | static void cat_blob(struct object_entry *oe, unsigned char sha1[20])
{
struct strbuf line = STRBUF_INIT;
unsigned long size;
enum object_type type = 0;
char *buf;
if (!oe || oe->pack_id == MAX_PACK_ID) {
buf = read_sha1_file(sha1, &type, &size);
} else {
type = oe->type;
buf = gfi_unpack_entry(oe, &size);... | Exec Code Overflow | 0 | static void cat_blob(struct object_entry *oe, unsigned char sha1[20])
{
struct strbuf line = STRBUF_INIT;
unsigned long size;
enum object_type type = 0;
char *buf;
if (!oe || oe->pack_id == MAX_PACK_ID) {
buf = read_sha1_file(sha1, &type, &size);
} else {
type = oe->type;
buf = gfi_unpack_entry(oe, &size);... | @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,140 | static uintmax_t change_note_fanout(struct tree_entry *root,
unsigned char fanout)
{
char hex_sha1[40], path[60];
return do_change_note_fanout(root, root, hex_sha1, 0, path, 0, fanout);
}
| Exec Code Overflow | 0 | static uintmax_t change_note_fanout(struct tree_entry *root,
unsigned char fanout)
{
char hex_sha1[40], path[60];
return do_change_note_fanout(root, root, hex_sha1, 0, path, 0, fanout);
}
| @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,141 | static void checkpoint(void)
{
checkpoint_requested = 0;
if (object_count) {
cycle_packfile();
dump_branches();
dump_tags();
dump_marks();
}
}
| Exec Code Overflow | 0 | static void checkpoint(void)
{
checkpoint_requested = 0;
if (object_count) {
cycle_packfile();
dump_branches();
dump_tags();
dump_marks();
}
}
| @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,142 | static void checkpoint_signal(int signo)
{
checkpoint_requested = 1;
}
| Exec Code Overflow | 0 | static void checkpoint_signal(int signo)
{
checkpoint_requested = 1;
}
| @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,143 | static void construct_path_with_fanout(const char *hex_sha1,
unsigned char fanout, char *path)
{
unsigned int i = 0, j = 0;
if (fanout >= 20)
die("Too large fanout (%u)", fanout);
while (fanout) {
path[i++] = hex_sha1[j++];
path[i++] = hex_sha1[j++];
path[i++] = '/';
fanout--;
}
memcpy(path + i, hex_sh... | Exec Code Overflow | 0 | static void construct_path_with_fanout(const char *hex_sha1,
unsigned char fanout, char *path)
{
unsigned int i = 0, j = 0;
if (fanout >= 20)
die("Too large fanout (%u)", fanout);
while (fanout) {
path[i++] = hex_sha1[j++];
path[i++] = hex_sha1[j++];
path[i++] = '/';
fanout--;
}
memcpy(path + i, hex_sh... | @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,144 | static unsigned char convert_num_notes_to_fanout(uintmax_t num_notes)
{
unsigned char fanout = 0;
while ((num_notes >>= 8))
fanout++;
return fanout;
}
| Exec Code Overflow | 0 | static unsigned char convert_num_notes_to_fanout(uintmax_t num_notes)
{
unsigned char fanout = 0;
while ((num_notes >>= 8))
fanout++;
return fanout;
}
| @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,145 | static const char *create_index(void)
{
const char *tmpfile;
struct pack_idx_entry **idx, **c, **last;
struct object_entry *e;
struct object_entry_pool *o;
/* Build the table of object IDs. */
idx = xmalloc(object_count * sizeof(*idx));
c = idx;
for (o = blocks; o; o = o->next_pool)
for (e = o->next_free; e-... | Exec Code Overflow | 0 | static const char *create_index(void)
{
const char *tmpfile;
struct pack_idx_entry **idx, **c, **last;
struct object_entry *e;
struct object_entry_pool *o;
/* Build the table of object IDs. */
idx = xmalloc(object_count * sizeof(*idx));
c = idx;
for (o = blocks; o; o = o->next_pool)
for (e = o->next_free; e-... | @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,146 | static void cycle_packfile(void)
{
end_packfile();
start_packfile();
}
| Exec Code Overflow | 0 | static void cycle_packfile(void)
{
end_packfile();
start_packfile();
}
| @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,147 | static NORETURN void die_nicely(const char *err, va_list params)
{
static int zombie;
char message[2 * PATH_MAX];
vsnprintf(message, sizeof(message), err, params);
fputs("fatal: ", stderr);
fputs(message, stderr);
fputc('\n', stderr);
if (!zombie) {
zombie = 1;
write_crash_report(message);
end_packfile()... | Exec Code Overflow | 0 | static NORETURN void die_nicely(const char *err, va_list params)
{
static int zombie;
char message[2 * PATH_MAX];
vsnprintf(message, sizeof(message), err, params);
fputs("fatal: ", stderr);
fputs(message, stderr);
fputc('\n', stderr);
if (!zombie) {
zombie = 1;
write_crash_report(message);
end_packfile()... | @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,148 | static uintmax_t do_change_note_fanout(
struct tree_entry *orig_root, struct tree_entry *root,
char *hex_sha1, unsigned int hex_sha1_len,
char *fullpath, unsigned int fullpath_len,
unsigned char fanout)
{
struct tree_content *t = root->tree;
struct tree_entry *e, leaf;
unsigned int i, tmp_hex_sha1_len, tmp_f... | Exec Code Overflow | 0 | static uintmax_t do_change_note_fanout(
struct tree_entry *orig_root, struct tree_entry *root,
char *hex_sha1, unsigned int hex_sha1_len,
char *fullpath, unsigned int fullpath_len,
unsigned char fanout)
{
struct tree_content *t = root->tree;
struct tree_entry *e, leaf;
unsigned int i, tmp_hex_sha1_len, tmp_f... | @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,149 | static void dump_branches(void)
{
unsigned int i;
struct branch *b;
for (i = 0; i < branch_table_sz; i++) {
for (b = branch_table[i]; b; b = b->table_next_branch)
failure |= update_branch(b);
}
}
| Exec Code Overflow | 0 | static void dump_branches(void)
{
unsigned int i;
struct branch *b;
for (i = 0; i < branch_table_sz; i++) {
for (b = branch_table[i]; b; b = b->table_next_branch)
failure |= update_branch(b);
}
}
| @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,150 | static void dump_marks(void)
{
static struct lock_file mark_lock;
FILE *f;
if (!export_marks_file)
return;
if (hold_lock_file_for_update(&mark_lock, export_marks_file, 0) < 0) {
failure |= error("Unable to write marks file %s: %s",
export_marks_file, strerror(errno));
return;
}
f = fdopen_lock_file(&m... | Exec Code Overflow | 0 | static void dump_marks(void)
{
static struct lock_file mark_lock;
FILE *f;
if (!export_marks_file)
return;
if (hold_lock_file_for_update(&mark_lock, export_marks_file, 0) < 0) {
failure |= error("Unable to write marks file %s: %s",
export_marks_file, strerror(errno));
return;
}
f = fdopen_lock_file(&m... | @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,151 | static void dump_tags(void)
{
static const char *msg = "fast-import";
struct tag *t;
struct strbuf ref_name = STRBUF_INIT;
struct strbuf err = STRBUF_INIT;
struct ref_transaction *transaction;
transaction = ref_transaction_begin(&err);
if (!transaction) {
failure |= error("%s", err.buf);
goto cleanup;
}
f... | Exec Code Overflow | 0 | static void dump_tags(void)
{
static const char *msg = "fast-import";
struct tag *t;
struct strbuf ref_name = STRBUF_INIT;
struct strbuf err = STRBUF_INIT;
struct ref_transaction *transaction;
transaction = ref_transaction_begin(&err);
if (!transaction) {
failure |= error("%s", err.buf);
goto cleanup;
}
f... | @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,152 | static struct tree_content *dup_tree_content(struct tree_content *s)
{
struct tree_content *d;
struct tree_entry *a, *b;
unsigned int i;
if (!s)
return NULL;
d = new_tree_content(s->entry_count);
for (i = 0; i < s->entry_count; i++) {
a = s->entries[i];
b = new_tree_entry();
memcpy(b, a, sizeof(*a));
i... | Exec Code Overflow | 0 | static struct tree_content *dup_tree_content(struct tree_content *s)
{
struct tree_content *d;
struct tree_entry *a, *b;
unsigned int i;
if (!s)
return NULL;
d = new_tree_content(s->entry_count);
for (i = 0; i < s->entry_count; i++) {
a = s->entries[i];
b = new_tree_entry();
memcpy(b, a, sizeof(*a));
i... | @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,153 | static void end_packfile(void)
{
static int running;
if (running || !pack_data)
return;
running = 1;
clear_delta_base_cache();
if (object_count) {
struct packed_git *new_p;
unsigned char cur_pack_sha1[20];
char *idx_name;
int i;
struct branch *b;
struct tag *t;
close_pack_windows(pack_data);
s... | Exec Code Overflow | 0 | static void end_packfile(void)
{
static int running;
if (running || !pack_data)
return;
running = 1;
clear_delta_base_cache();
if (object_count) {
struct packed_git *new_p;
unsigned char cur_pack_sha1[20];
char *idx_name;
int i;
struct branch *b;
struct tag *t;
close_pack_windows(pack_data);
s... | @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,154 | static void file_change_deleteall(struct branch *b)
{
release_tree_content_recursive(b->branch_tree.tree);
hashclr(b->branch_tree.versions[0].sha1);
hashclr(b->branch_tree.versions[1].sha1);
load_tree(&b->branch_tree);
b->num_notes = 0;
}
| Exec Code Overflow | 0 | static void file_change_deleteall(struct branch *b)
{
release_tree_content_recursive(b->branch_tree.tree);
hashclr(b->branch_tree.versions[0].sha1);
hashclr(b->branch_tree.versions[1].sha1);
load_tree(&b->branch_tree);
b->num_notes = 0;
}
| @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,155 | static void file_change_m(const char *p, struct branch *b)
{
static struct strbuf uq = STRBUF_INIT;
const char *endp;
struct object_entry *oe;
unsigned char sha1[20];
uint16_t mode, inline_data = 0;
p = get_mode(p, &mode);
if (!p)
die("Corrupt mode: %s", command_buf.buf);
switch (mode) {
case 0644:
case 07... | Exec Code Overflow | 0 | static void file_change_m(const char *p, struct branch *b)
{
static struct strbuf uq = STRBUF_INIT;
const char *endp;
struct object_entry *oe;
unsigned char sha1[20];
uint16_t mode, inline_data = 0;
p = get_mode(p, &mode);
if (!p)
die("Corrupt mode: %s", command_buf.buf);
switch (mode) {
case 0644:
case 07... | @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,156 | static struct object_entry *find_mark(uintmax_t idnum)
{
uintmax_t orig_idnum = idnum;
struct mark_set *s = marks;
struct object_entry *oe = NULL;
if ((idnum >> s->shift) < 1024) {
while (s && s->shift) {
uintmax_t i = idnum >> s->shift;
idnum -= i << s->shift;
s = s->data.sets[i];
}
if (s)
oe = s... | Exec Code Overflow | 0 | static struct object_entry *find_mark(uintmax_t idnum)
{
uintmax_t orig_idnum = idnum;
struct mark_set *s = marks;
struct object_entry *oe = NULL;
if ((idnum >> s->shift) < 1024) {
while (s && s->shift) {
uintmax_t i = idnum >> s->shift;
idnum -= i << s->shift;
s = s->data.sets[i];
}
if (s)
oe = s... | @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,157 | static struct object_entry *find_object(unsigned char *sha1)
{
unsigned int h = sha1[0] << 8 | sha1[1];
struct object_entry *e;
for (e = object_table[h]; e; e = e->next)
if (!hashcmp(sha1, e->idx.sha1))
return e;
return NULL;
}
| Exec Code Overflow | 0 | static struct object_entry *find_object(unsigned char *sha1)
{
unsigned int h = sha1[0] << 8 | sha1[1];
struct object_entry *e;
for (e = object_table[h]; e; e = e->next)
if (!hashcmp(sha1, e->idx.sha1))
return e;
return NULL;
}
| @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,158 | static const char *get_mode(const char *str, uint16_t *modep)
{
unsigned char c;
uint16_t mode = 0;
while ((c = *str++) != ' ') {
if (c < '0' || c > '7')
return NULL;
mode = (mode << 3) + (c - '0');
}
*modep = mode;
return str;
}
| Exec Code Overflow | 0 | static const char *get_mode(const char *str, uint16_t *modep)
{
unsigned char c;
uint16_t mode = 0;
while ((c = *str++) != ' ') {
if (c < '0' || c > '7')
return NULL;
mode = (mode << 3) + (c - '0');
}
*modep = mode;
return str;
}
| @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,159 | static void *gfi_unpack_entry(
struct object_entry *oe,
unsigned long *sizep)
{
enum object_type type;
struct packed_git *p = all_packs[oe->pack_id];
if (p == pack_data && p->pack_size < (pack_size + 20)) {
/* The object is stored in the packfile we are writing to
* and we have modified it since the last time... | Exec Code Overflow | 0 | static void *gfi_unpack_entry(
struct object_entry *oe,
unsigned long *sizep)
{
enum object_type type;
struct packed_git *p = all_packs[oe->pack_id];
if (p == pack_data && p->pack_size < (pack_size + 20)) {
/* The object is stored in the packfile we are writing to
* and we have modified it since the last time... | @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,160 | static void git_pack_config(void)
{
int indexversion_value;
unsigned long packsizelimit_value;
if (!git_config_get_ulong("pack.depth", &max_depth)) {
if (max_depth > MAX_DEPTH)
max_depth = MAX_DEPTH;
}
if (!git_config_get_int("pack.compression", &pack_compression_level)) {
if (pack_compression_level == -1)... | Exec Code Overflow | 0 | static void git_pack_config(void)
{
int indexversion_value;
unsigned long packsizelimit_value;
if (!git_config_get_ulong("pack.depth", &max_depth)) {
if (max_depth > MAX_DEPTH)
max_depth = MAX_DEPTH;
}
if (!git_config_get_int("pack.compression", &pack_compression_level)) {
if (pack_compression_level == -1)... | @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,161 | static struct tree_content *grow_tree_content(
struct tree_content *t,
int amt)
{
struct tree_content *r = new_tree_content(t->entry_count + amt);
r->entry_count = t->entry_count;
r->delta_depth = t->delta_depth;
memcpy(r->entries,t->entries,t->entry_count*sizeof(t->entries[0]));
release_tree_content(t);
return... | Exec Code Overflow | 0 | static struct tree_content *grow_tree_content(
struct tree_content *t,
int amt)
{
struct tree_content *r = new_tree_content(t->entry_count + amt);
r->entry_count = t->entry_count;
r->delta_depth = t->delta_depth;
memcpy(r->entries,t->entries,t->entry_count*sizeof(t->entries[0]));
release_tree_content(t);
return... | @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,162 | static unsigned int hc_str(const char *s, size_t len)
{
unsigned int r = 0;
while (len-- > 0)
r = r * 31 + *s++;
return r;
}
| Exec Code Overflow | 0 | static unsigned int hc_str(const char *s, size_t len)
{
unsigned int r = 0;
while (len-- > 0)
r = r * 31 + *s++;
return r;
}
| @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,163 | static void insert_mark(uintmax_t idnum, struct object_entry *oe)
{
struct mark_set *s = marks;
while ((idnum >> s->shift) >= 1024) {
s = pool_calloc(1, sizeof(struct mark_set));
s->shift = marks->shift + 10;
s->data.sets[0] = marks;
marks = s;
}
while (s->shift) {
uintmax_t i = idnum >> s->shift;
idnum... | Exec Code Overflow | 0 | static void insert_mark(uintmax_t idnum, struct object_entry *oe)
{
struct mark_set *s = marks;
while ((idnum >> s->shift) >= 1024) {
s = pool_calloc(1, sizeof(struct mark_set));
s->shift = marks->shift + 10;
s->data.sets[0] = marks;
marks = s;
}
while (s->shift) {
uintmax_t i = idnum >> s->shift;
idnum... | @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,164 | static struct object_entry *insert_object(unsigned char *sha1)
{
unsigned int h = sha1[0] << 8 | sha1[1];
struct object_entry *e = object_table[h];
while (e) {
if (!hashcmp(sha1, e->idx.sha1))
return e;
e = e->next;
}
e = new_object(sha1);
e->next = object_table[h];
e->idx.offset = 0;
object_table[h] =... | Exec Code Overflow | 0 | static struct object_entry *insert_object(unsigned char *sha1)
{
unsigned int h = sha1[0] << 8 | sha1[1];
struct object_entry *e = object_table[h];
while (e) {
if (!hashcmp(sha1, e->idx.sha1))
return e;
e = e->next;
}
e = new_object(sha1);
e->next = object_table[h];
e->idx.offset = 0;
object_table[h] =... | @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,165 | static char *keep_pack(const char *curr_index_name)
{
static char name[PATH_MAX];
static const char *keep_msg = "fast-import";
int keep_fd;
keep_fd = odb_pack_keep(name, sizeof(name), pack_data->sha1);
if (keep_fd < 0)
die_errno("cannot create keep file");
write_or_die(keep_fd, keep_msg, strlen(keep_msg));
if... | Exec Code Overflow | 0 | static char *keep_pack(const char *curr_index_name)
{
static char name[PATH_MAX];
static const char *keep_msg = "fast-import";
int keep_fd;
keep_fd = odb_pack_keep(name, sizeof(name), pack_data->sha1);
if (keep_fd < 0)
die_errno("cannot create keep file");
write_or_die(keep_fd, keep_msg, strlen(keep_msg));
if... | @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,166 | static void load_branch(struct branch *b)
{
load_tree(&b->branch_tree);
if (!b->active) {
b->active = 1;
b->active_next_branch = active_branches;
active_branches = b;
cur_active_branches++;
branch_load_count++;
}
}
| Exec Code Overflow | 0 | static void load_branch(struct branch *b)
{
load_tree(&b->branch_tree);
if (!b->active) {
b->active = 1;
b->active_next_branch = active_branches;
active_branches = b;
cur_active_branches++;
branch_load_count++;
}
}
| @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,167 | static void load_tree(struct tree_entry *root)
{
unsigned char *sha1 = root->versions[1].sha1;
struct object_entry *myoe;
struct tree_content *t;
unsigned long size;
char *buf;
const char *c;
root->tree = t = new_tree_content(8);
if (is_null_sha1(sha1))
return;
myoe = find_object(sha1);
if (myoe && myoe->... | Exec Code Overflow | 0 | static void load_tree(struct tree_entry *root)
{
unsigned char *sha1 = root->versions[1].sha1;
struct object_entry *myoe;
struct tree_content *t;
unsigned long size;
char *buf;
const char *c;
root->tree = t = new_tree_content(8);
if (is_null_sha1(sha1))
return;
myoe = find_object(sha1);
if (myoe && myoe->... | @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,168 | int main(int argc, char **argv)
{
unsigned int i;
git_extract_argv0_path(argv[0]);
git_setup_gettext();
if (argc == 2 && !strcmp(argv[1], "-h"))
usage(fast_import_usage);
setup_git_directory();
reset_pack_idx_option(&pack_idx_opts);
git_pack_config();
if (!pack_compression_seen && core_compression_seen)
... | Exec Code Overflow | 0 | int main(int argc, char **argv)
{
unsigned int i;
git_extract_argv0_path(argv[0]);
git_setup_gettext();
if (argc == 2 && !strcmp(argv[1], "-h"))
usage(fast_import_usage);
setup_git_directory();
reset_pack_idx_option(&pack_idx_opts);
git_pack_config();
if (!pack_compression_seen && core_compression_seen)
... | @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,169 | static struct branch *new_branch(const char *name)
{
unsigned int hc = hc_str(name, strlen(name)) % branch_table_sz;
struct branch *b = lookup_branch(name);
if (b)
die("Invalid attempt to create duplicate branch: %s", name);
if (check_refname_format(name, REFNAME_ALLOW_ONELEVEL))
die("Branch name doesn't confo... | Exec Code Overflow | 0 | static struct branch *new_branch(const char *name)
{
unsigned int hc = hc_str(name, strlen(name)) % branch_table_sz;
struct branch *b = lookup_branch(name);
if (b)
die("Invalid attempt to create duplicate branch: %s", name);
if (check_refname_format(name, REFNAME_ALLOW_ONELEVEL))
die("Branch name doesn't confo... | @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,170 | static struct object_entry *new_object(unsigned char *sha1)
{
struct object_entry *e;
if (blocks->next_free == blocks->end)
alloc_objects(object_entry_alloc);
e = blocks->next_free++;
hashcpy(e->idx.sha1, sha1);
return e;
}
| Exec Code Overflow | 0 | static struct object_entry *new_object(unsigned char *sha1)
{
struct object_entry *e;
if (blocks->next_free == blocks->end)
alloc_objects(object_entry_alloc);
e = blocks->next_free++;
hashcpy(e->idx.sha1, sha1);
return e;
}
| @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,171 | static struct tree_entry *new_tree_entry(void)
{
struct tree_entry *e;
if (!avail_tree_entry) {
unsigned int n = tree_entry_alloc;
total_allocd += n * sizeof(struct tree_entry);
avail_tree_entry = e = xmalloc(n * sizeof(struct tree_entry));
while (n-- > 1) {
*((void**)e) = e + 1;
e++;
}
*((void**)e... | Exec Code Overflow | 0 | static struct tree_entry *new_tree_entry(void)
{
struct tree_entry *e;
if (!avail_tree_entry) {
unsigned int n = tree_entry_alloc;
total_allocd += n * sizeof(struct tree_entry);
avail_tree_entry = e = xmalloc(n * sizeof(struct tree_entry));
while (n-- > 1) {
*((void**)e) = e + 1;
e++;
}
*((void**)e... | @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,172 | static void note_change_n(const char *p, struct branch *b, unsigned char *old_fanout)
{
static struct strbuf uq = STRBUF_INIT;
struct object_entry *oe;
struct branch *s;
unsigned char sha1[20], commit_sha1[20];
char path[60];
uint16_t inline_data = 0;
unsigned char new_fanout;
/*
* When loading a branch, we ... | Exec Code Overflow | 0 | static void note_change_n(const char *p, struct branch *b, unsigned char *old_fanout)
{
static struct strbuf uq = STRBUF_INIT;
struct object_entry *oe;
struct branch *s;
unsigned char sha1[20], commit_sha1[20];
char path[60];
uint16_t inline_data = 0;
unsigned char new_fanout;
/*
* When loading a branch, we ... | @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,173 | static void option_active_branches(const char *branches)
{
max_active_branches = ulong_arg("--active-branches", branches);
}
| Exec Code Overflow | 0 | static void option_active_branches(const char *branches)
{
max_active_branches = ulong_arg("--active-branches", branches);
}
| @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,174 | static void option_cat_blob_fd(const char *fd)
{
unsigned long n = ulong_arg("--cat-blob-fd", fd);
if (n > (unsigned long) INT_MAX)
die("--cat-blob-fd cannot exceed %d", INT_MAX);
cat_blob_fd = (int) n;
}
| Exec Code Overflow | 0 | static void option_cat_blob_fd(const char *fd)
{
unsigned long n = ulong_arg("--cat-blob-fd", fd);
if (n > (unsigned long) INT_MAX)
die("--cat-blob-fd cannot exceed %d", INT_MAX);
cat_blob_fd = (int) n;
}
| @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,175 | static void option_date_format(const char *fmt)
{
if (!strcmp(fmt, "raw"))
whenspec = WHENSPEC_RAW;
else if (!strcmp(fmt, "rfc2822"))
whenspec = WHENSPEC_RFC2822;
else if (!strcmp(fmt, "now"))
whenspec = WHENSPEC_NOW;
else
die("unknown --date-format argument %s", fmt);
}
| Exec Code Overflow | 0 | static void option_date_format(const char *fmt)
{
if (!strcmp(fmt, "raw"))
whenspec = WHENSPEC_RAW;
else if (!strcmp(fmt, "rfc2822"))
whenspec = WHENSPEC_RFC2822;
else if (!strcmp(fmt, "now"))
whenspec = WHENSPEC_NOW;
else
die("unknown --date-format argument %s", fmt);
}
| @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,176 | static void option_depth(const char *depth)
{
max_depth = ulong_arg("--depth", depth);
if (max_depth > MAX_DEPTH)
die("--depth cannot exceed %u", MAX_DEPTH);
}
| Exec Code Overflow | 0 | static void option_depth(const char *depth)
{
max_depth = ulong_arg("--depth", depth);
if (max_depth > MAX_DEPTH)
die("--depth cannot exceed %u", MAX_DEPTH);
}
| @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,177 | static void option_export_pack_edges(const char *edges)
{
if (pack_edges)
fclose(pack_edges);
pack_edges = fopen(edges, "a");
if (!pack_edges)
die_errno("Cannot open '%s'", edges);
}
| Exec Code Overflow | 0 | static void option_export_pack_edges(const char *edges)
{
if (pack_edges)
fclose(pack_edges);
pack_edges = fopen(edges, "a");
if (!pack_edges)
die_errno("Cannot open '%s'", edges);
}
| @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,178 | static void parse_and_store_blob(
struct last_object *last,
unsigned char *sha1out,
uintmax_t mark)
{
static struct strbuf buf = STRBUF_INIT;
uintmax_t len;
if (parse_data(&buf, big_file_threshold, &len))
store_object(OBJ_BLOB, &buf, last, sha1out, mark);
else {
if (last) {
strbuf_release(&last->data);
... | Exec Code Overflow | 0 | static void parse_and_store_blob(
struct last_object *last,
unsigned char *sha1out,
uintmax_t mark)
{
static struct strbuf buf = STRBUF_INIT;
uintmax_t len;
if (parse_data(&buf, big_file_threshold, &len))
store_object(OBJ_BLOB, &buf, last, sha1out, mark);
else {
if (last) {
strbuf_release(&last->data);
... | @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,179 | static void parse_argv(void)
{
unsigned int i;
for (i = 1; i < global_argc; i++) {
const char *a = global_argv[i];
if (*a != '-' || !strcmp(a, "--"))
break;
if (!skip_prefix(a, "--", &a))
die("unknown option %s", a);
if (parse_one_option(a))
continue;
if (parse_one_feature(a, 0))
continue;
... | Exec Code Overflow | 0 | static void parse_argv(void)
{
unsigned int i;
for (i = 1; i < global_argc; i++) {
const char *a = global_argv[i];
if (*a != '-' || !strcmp(a, "--"))
break;
if (!skip_prefix(a, "--", &a))
die("unknown option %s", a);
if (parse_one_option(a))
continue;
if (parse_one_feature(a, 0))
continue;
... | @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,180 | static void parse_cat_blob(const char *p)
{
struct object_entry *oe = oe;
unsigned char sha1[20];
/* cat-blob SP <object> LF */
if (*p == ':') {
oe = find_mark(parse_mark_ref_eol(p));
if (!oe)
die("Unknown mark: %s", command_buf.buf);
hashcpy(sha1, oe->idx.sha1);
} else {
if (get_sha1_hex(p, sha1))
... | Exec Code Overflow | 0 | static void parse_cat_blob(const char *p)
{
struct object_entry *oe = oe;
unsigned char sha1[20];
/* cat-blob SP <object> LF */
if (*p == ':') {
oe = find_mark(parse_mark_ref_eol(p));
if (!oe)
die("Unknown mark: %s", command_buf.buf);
hashcpy(sha1, oe->idx.sha1);
} else {
if (get_sha1_hex(p, sha1))
... | @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,181 | static int parse_data(struct strbuf *sb, uintmax_t limit, uintmax_t *len_res)
{
const char *data;
strbuf_reset(sb);
if (!skip_prefix(command_buf.buf, "data ", &data))
die("Expected 'data n' command, found: %s", command_buf.buf);
if (skip_prefix(data, "<<", &data)) {
char *term = xstrdup(data);
size_t term_l... | Exec Code Overflow | 0 | static int parse_data(struct strbuf *sb, uintmax_t limit, uintmax_t *len_res)
{
const char *data;
strbuf_reset(sb);
if (!skip_prefix(command_buf.buf, "data ", &data))
die("Expected 'data n' command, found: %s", command_buf.buf);
if (skip_prefix(data, "<<", &data)) {
char *term = xstrdup(data);
size_t term_l... | @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,182 | static void parse_feature(const char *feature)
{
if (seen_data_command)
die("Got feature command '%s' after data command", feature);
if (parse_one_feature(feature, 1))
return;
die("This version of fast-import does not support feature %s.", feature);
}
| Exec Code Overflow | 0 | static void parse_feature(const char *feature)
{
if (seen_data_command)
die("Got feature command '%s' after data command", feature);
if (parse_one_feature(feature, 1))
return;
die("This version of fast-import does not support feature %s.", feature);
}
| @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,183 | static int parse_from(struct branch *b)
{
const char *from;
struct branch *s;
unsigned char sha1[20];
if (!skip_prefix(command_buf.buf, "from ", &from))
return 0;
hashcpy(sha1, b->branch_tree.versions[1].sha1);
s = lookup_branch(from);
if (b == s)
die("Can't create a branch from itself: %s", b->name);
el... | Exec Code Overflow | 0 | static int parse_from(struct branch *b)
{
const char *from;
struct branch *s;
unsigned char sha1[20];
if (!skip_prefix(command_buf.buf, "from ", &from))
return 0;
hashcpy(sha1, b->branch_tree.versions[1].sha1);
s = lookup_branch(from);
if (b == s)
die("Can't create a branch from itself: %s", b->name);
el... | @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,184 | static void parse_from_existing(struct branch *b)
{
if (is_null_sha1(b->sha1)) {
hashclr(b->branch_tree.versions[0].sha1);
hashclr(b->branch_tree.versions[1].sha1);
} else {
unsigned long size;
char *buf;
buf = read_object_with_reference(b->sha1,
commit_type, &size, b->sha1);
parse_from_commit(b, buf,... | Exec Code Overflow | 0 | static void parse_from_existing(struct branch *b)
{
if (is_null_sha1(b->sha1)) {
hashclr(b->branch_tree.versions[0].sha1);
hashclr(b->branch_tree.versions[1].sha1);
} else {
unsigned long size;
char *buf;
buf = read_object_with_reference(b->sha1,
commit_type, &size, b->sha1);
parse_from_commit(b, buf,... | @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,185 | static void parse_get_mark(const char *p)
{
struct object_entry *oe = oe;
char output[42];
/* get-mark SP <object> LF */
if (*p != ':')
die("Not a mark: %s", p);
oe = find_mark(parse_mark_ref_eol(p));
if (!oe)
die("Unknown mark: %s", command_buf.buf);
snprintf(output, sizeof(output), "%s\n", sha1_to_hex(o... | Exec Code Overflow | 0 | static void parse_get_mark(const char *p)
{
struct object_entry *oe = oe;
char output[42];
/* get-mark SP <object> LF */
if (*p != ':')
die("Not a mark: %s", p);
oe = find_mark(parse_mark_ref_eol(p));
if (!oe)
die("Unknown mark: %s", command_buf.buf);
snprintf(output, sizeof(output), "%s\n", sha1_to_hex(o... | @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,186 | static char *parse_ident(const char *buf)
{
const char *ltgt;
size_t name_len;
struct strbuf ident = STRBUF_INIT;
/* ensure there is a space delimiter even if there is no name */
if (*buf == '<')
--buf;
ltgt = buf + strcspn(buf, "<>");
if (*ltgt != '<')
die("Missing < in ident string: %s", buf);
if (ltgt ... | Exec Code Overflow | 0 | static char *parse_ident(const char *buf)
{
const char *ltgt;
size_t name_len;
struct strbuf ident = STRBUF_INIT;
/* ensure there is a space delimiter even if there is no name */
if (*buf == '<')
--buf;
ltgt = buf + strcspn(buf, "<>");
if (*ltgt != '<')
die("Missing < in ident string: %s", buf);
if (ltgt ... | @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,187 | static void parse_ls(const char *p, struct branch *b)
{
struct tree_entry *root = NULL;
struct tree_entry leaf = {NULL};
/* ls SP (<tree-ish> SP)? <path> */
if (*p == '"') {
if (!b)
die("Not in a commit: %s", command_buf.buf);
root = &b->branch_tree;
} else {
struct object_entry *e = parse_treeish_datare... | Exec Code Overflow | 0 | static void parse_ls(const char *p, struct branch *b)
{
struct tree_entry *root = NULL;
struct tree_entry leaf = {NULL};
/* ls SP (<tree-ish> SP)? <path> */
if (*p == '"') {
if (!b)
die("Not in a commit: %s", command_buf.buf);
root = &b->branch_tree;
} else {
struct object_entry *e = parse_treeish_datare... | @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,188 | static void parse_mark(void)
{
const char *v;
if (skip_prefix(command_buf.buf, "mark :", &v)) {
next_mark = strtoumax(v, NULL, 10);
read_next_command();
}
else
next_mark = 0;
}
| Exec Code Overflow | 0 | static void parse_mark(void)
{
const char *v;
if (skip_prefix(command_buf.buf, "mark :", &v)) {
next_mark = strtoumax(v, NULL, 10);
read_next_command();
}
else
next_mark = 0;
}
| @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,189 | static uintmax_t parse_mark_ref(const char *p, char **endptr)
{
uintmax_t mark;
assert(*p == ':');
p++;
mark = strtoumax(p, endptr, 10);
if (*endptr == p)
die("No value after ':' in mark: %s", command_buf.buf);
return mark;
}
| Exec Code Overflow | 0 | static uintmax_t parse_mark_ref(const char *p, char **endptr)
{
uintmax_t mark;
assert(*p == ':');
p++;
mark = strtoumax(p, endptr, 10);
if (*endptr == p)
die("No value after ':' in mark: %s", command_buf.buf);
return mark;
}
| @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,190 | static uintmax_t parse_mark_ref_space(const char **p)
{
uintmax_t mark;
char *end;
mark = parse_mark_ref(*p, &end);
if (*end++ != ' ')
die("Missing space after mark: %s", command_buf.buf);
*p = end;
return mark;
}
| Exec Code Overflow | 0 | static uintmax_t parse_mark_ref_space(const char **p)
{
uintmax_t mark;
char *end;
mark = parse_mark_ref(*p, &end);
if (*end++ != ' ')
die("Missing space after mark: %s", command_buf.buf);
*p = end;
return mark;
}
| @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,191 | static struct hash_list *parse_merge(unsigned int *count)
{
struct hash_list *list = NULL, **tail = &list, *n;
const char *from;
struct branch *s;
*count = 0;
while (skip_prefix(command_buf.buf, "merge ", &from)) {
n = xmalloc(sizeof(*n));
s = lookup_branch(from);
if (s)
hashcpy(n->sha1, s->sha1);
else... | Exec Code Overflow | 0 | static struct hash_list *parse_merge(unsigned int *count)
{
struct hash_list *list = NULL, **tail = &list, *n;
const char *from;
struct branch *s;
*count = 0;
while (skip_prefix(command_buf.buf, "merge ", &from)) {
n = xmalloc(sizeof(*n));
s = lookup_branch(from);
if (s)
hashcpy(n->sha1, s->sha1);
else... | @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,192 | static void parse_new_blob(void)
{
read_next_command();
parse_mark();
parse_and_store_blob(&last_blob, NULL, next_mark);
}
| Exec Code Overflow | 0 | static void parse_new_blob(void)
{
read_next_command();
parse_mark();
parse_and_store_blob(&last_blob, NULL, next_mark);
}
| @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,193 | static void parse_new_commit(const char *arg)
{
static struct strbuf msg = STRBUF_INIT;
struct branch *b;
char *author = NULL;
char *committer = NULL;
struct hash_list *merge_list = NULL;
unsigned int merge_count;
unsigned char prev_fanout, new_fanout;
const char *v;
b = lookup_branch(arg);
if (!b)
b = new... | Exec Code Overflow | 0 | static void parse_new_commit(const char *arg)
{
static struct strbuf msg = STRBUF_INIT;
struct branch *b;
char *author = NULL;
char *committer = NULL;
struct hash_list *merge_list = NULL;
unsigned int merge_count;
unsigned char prev_fanout, new_fanout;
const char *v;
b = lookup_branch(arg);
if (!b)
b = new... | @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,194 | static void parse_new_tag(const char *arg)
{
static struct strbuf msg = STRBUF_INIT;
const char *from;
char *tagger;
struct branch *s;
struct tag *t;
uintmax_t from_mark = 0;
unsigned char sha1[20];
enum object_type type;
const char *v;
t = pool_alloc(sizeof(struct tag));
memset(t, 0, sizeof(struct tag));
... | Exec Code Overflow | 0 | static void parse_new_tag(const char *arg)
{
static struct strbuf msg = STRBUF_INIT;
const char *from;
char *tagger;
struct branch *s;
struct tag *t;
uintmax_t from_mark = 0;
unsigned char sha1[20];
enum object_type type;
const char *v;
t = pool_alloc(sizeof(struct tag));
memset(t, 0, sizeof(struct tag));
... | @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,195 | static int parse_one_feature(const char *feature, int from_stream)
{
const char *arg;
if (skip_prefix(feature, "date-format=", &arg)) {
option_date_format(arg);
} else if (skip_prefix(feature, "import-marks=", &arg)) {
option_import_marks(arg, from_stream, 0);
} else if (skip_prefix(feature, "import-marks-if-e... | Exec Code Overflow | 0 | static int parse_one_feature(const char *feature, int from_stream)
{
const char *arg;
if (skip_prefix(feature, "date-format=", &arg)) {
option_date_format(arg);
} else if (skip_prefix(feature, "import-marks=", &arg)) {
option_import_marks(arg, from_stream, 0);
} else if (skip_prefix(feature, "import-marks-if-e... | @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,196 | static int parse_one_option(const char *option)
{
if (skip_prefix(option, "max-pack-size=", &option)) {
unsigned long v;
if (!git_parse_ulong(option, &v))
return 0;
if (v < 8192) {
warning("max-pack-size is now in bytes, assuming --max-pack-size=%lum", v);
v *= 1024 * 1024;
} else if (v < 1024 * 1024)... | Exec Code Overflow | 0 | static int parse_one_option(const char *option)
{
if (skip_prefix(option, "max-pack-size=", &option)) {
unsigned long v;
if (!git_parse_ulong(option, &v))
return 0;
if (v < 8192) {
warning("max-pack-size is now in bytes, assuming --max-pack-size=%lum", v);
v *= 1024 * 1024;
} else if (v < 1024 * 1024)... | @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,197 | static void parse_option(const char *option)
{
if (seen_data_command)
die("Got option command '%s' after data command", option);
if (parse_one_option(option))
return;
die("This version of fast-import does not support option: %s", option);
}
| Exec Code Overflow | 0 | static void parse_option(const char *option)
{
if (seen_data_command)
die("Got option command '%s' after data command", option);
if (parse_one_option(option))
return;
die("This version of fast-import does not support option: %s", option);
}
| @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,198 | static void parse_reset_branch(const char *arg)
{
struct branch *b;
b = lookup_branch(arg);
if (b) {
hashclr(b->sha1);
hashclr(b->branch_tree.versions[0].sha1);
hashclr(b->branch_tree.versions[1].sha1);
if (b->branch_tree.tree) {
release_tree_content_recursive(b->branch_tree.tree);
b->branch_tree.tree... | Exec Code Overflow | 0 | static void parse_reset_branch(const char *arg)
{
struct branch *b;
b = lookup_branch(arg);
if (b) {
hashclr(b->sha1);
hashclr(b->branch_tree.versions[0].sha1);
hashclr(b->branch_tree.versions[1].sha1);
if (b->branch_tree.tree) {
release_tree_content_recursive(b->branch_tree.tree);
b->branch_tree.tree... | @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
44,199 | static struct object_entry *parse_treeish_dataref(const char **p)
{
unsigned char sha1[20];
struct object_entry *e;
if (**p == ':') { /* <mark> */
e = find_mark(parse_mark_ref_space(p));
if (!e)
die("Unknown mark: %s", command_buf.buf);
hashcpy(sha1, e->idx.sha1);
} else { /* <sha1> */
if (get_sha1_hex(... | Exec Code Overflow | 0 | static struct object_entry *parse_treeish_dataref(const char **p)
{
unsigned char sha1[20];
struct object_entry *e;
if (**p == ':') { /* <mark> */
e = find_mark(parse_mark_ref_space(p));
if (!e)
die("Unknown mark: %s", command_buf.buf);
hashcpy(sha1, e->idx.sha1);
} else { /* <sha1> */
if (get_sha1_hex(... | @@ -644,8 +644,9 @@ static void *pool_calloc(size_t count, size_t size)
static char *pool_strdup(const char *s)
{
- char *r = pool_alloc(strlen(s) + 1);
- strcpy(r, s);
+ size_t len = strlen(s) + 1;
+ char *r = pool_alloc(len);
+ memcpy(r, s, len);
return r;
}
| CWE-119 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.