commit - 4a26d3f877326c99bcf462b076800a112319ff6d
commit + dbdd620944b55aa6cbe81fede1db6443521ac3ec
blob - a13a191e043c94ff5f692e1f875fda3b1eb9cb21
blob + a8e56d3ae101b242e7f90d82f2276a5ab517a4fb
--- lib/object.c
+++ lib/object.c
struct got_object_id *commit_id, struct got_repository *repo)
{
const struct got_error *err = NULL;
+ char buf[PATH_MAX];
char *name, *parent_path = NULL;
struct got_object_id *tree_obj_id = NULL;
struct got_tree_object *tree = NULL;
*link_target = NULL;
- name = basename(path);
+ if (strlcpy(buf, path, sizeof(buf)) >= sizeof(buf))
+ return got_error(GOT_ERR_NO_SPACE);
+
+ name = basename(buf);
if (name == NULL)
return got_error_from_errno2("basename", path);