commit - dbdd620944b55aa6cbe81fede1db6443521ac3ec
commit + 0a9483d0af324e2f67bb3af427577a35fb7ed401
blob - 549cac5f15819dd3e37527467f02c394f51d5006
blob + 0648aebafecc757f25710300b9e98d53c91c585a
--- lib/path.c
+++ lib/path.c
const struct got_error *
got_path_basename(char **s, const char *path)
{
+ char buf[PATH_MAX];
char *base;
- base = basename(path);
+ if (strlcpy(buf, path, sizeof(buf)) >= sizeof(buf))
+ return got_error(GOT_ERR_NO_SPACE);
+
+ base = basename(buf);
if (base == NULL)
return got_error_from_errno2("basename", path);