aboutsummaryrefslogtreecommitdiff
path: root/archive.c
diff options
context:
space:
mode:
Diffstat (limited to 'archive.c')
-rw-r--r--archive.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/archive.c b/archive.c
index 7d0976fe5..3fc0fb292 100644
--- a/archive.c
+++ b/archive.c
@@ -260,8 +260,8 @@ static void parse_treeish_arg(const char **argv,
/* Remotes are only allowed to fetch actual refs */
if (remote && !remote_allow_unreachable) {
char *ref = NULL;
- const char *colon = strchr(name, ':');
- int refnamelen = colon ? colon - name : strlen(name);
+ const char *colon = strchrnul(name, ':');
+ int refnamelen = colon - name;
if (!dwim_ref(name, refnamelen, sha1, &ref))
die("no such ref: %.*s", refnamelen, name);