Merge branch 'rm/strchrnul-not-strlen'
authorJunio C Hamano <gitster@pobox.com>
Tue, 18 Mar 2014 20:51:18 +0000 (13:51 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 18 Mar 2014 20:51:18 +0000 (13:51 -0700)
* rm/strchrnul-not-strlen:
use strchrnul() in place of strchr() and strlen()

1  2 
archive.c
cache-tree.c
diff.c
pretty.c
diff --cc archive.c
index 7d0976fe55b8ef7b9009d080f7c1c0651a05def7,d1962157c8865de32a59d6f364616758377ae560..3fc0fb2928f1007ec5d8763d9d3a9b88152059ad
+++ b/archive.c
@@@ -258,10 -257,10 +258,10 @@@ static void parse_treeish_arg(const cha
        unsigned char sha1[20];
  
        /* Remotes are only allowed to fetch actual refs */
 -      if (remote) {
 +      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);
diff --cc cache-tree.c
Simple merge
diff --cc diff.c
Simple merge
diff --cc pretty.c
Simple merge