summaryrefslogtreecommitdiff
path: root/builtin/ls-remote.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin/ls-remote.c')
-rw-r--r--builtin/ls-remote.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/builtin/ls-remote.c b/builtin/ls-remote.c
index 66cdd45..b2d7d5c 100644
--- a/builtin/ls-remote.c
+++ b/builtin/ls-remote.c
@@ -17,17 +17,19 @@ static const char * const ls_remote_usage[] = {
static int tail_match(const char **pattern, const char *path)
{
const char *p;
- char pathbuf[PATH_MAX];
+ char *pathbuf;
if (!pattern)
return 1; /* no restriction */
- if (snprintf(pathbuf, sizeof(pathbuf), "/%s", path) > sizeof(pathbuf))
- return error("insanely long ref %.*s...", 20, path);
+ pathbuf = xstrfmt("/%s", path);
while ((p = *(pattern++)) != NULL) {
- if (!wildmatch(p, pathbuf, 0, NULL))
+ if (!wildmatch(p, pathbuf, 0, NULL)) {
+ free(pathbuf);
return 1;
+ }
}
+ free(pathbuf);
return 0;
}