summaryrefslogtreecommitdiff
path: root/builtin-grep.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-06-21 02:50:59 -0700
committerJunio C Hamano <junkio@cox.net>2006-06-21 02:50:59 -0700
commit3bec0da08d6df03a103ddc4237cf2c79992c7dd4 (patch)
treec6b26993418a86b7c1eb72dcdff17489b5e410b1 /builtin-grep.c
parent48401221b349696357b35e02ff3e2c3d3c89d306 (diff)
parent583b7ea31b7c16f872b178d541591ab816d16f85 (diff)
downloadgit-3bec0da08d6df03a103ddc4237cf2c79992c7dd4.tar.gz
Merge branch 'jc/upload-corrupt' into next
* jc/upload-corrupt: upload-pack/fetch-pack: support side-band communication Retire git-clone-pack upload-pack: prepare for sideband message support. upload-pack: avoid sending an incomplete pack upon failure Fix possible out-of-bounds array access
Diffstat (limited to 'builtin-grep.c')
-rw-r--r--builtin-grep.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/builtin-grep.c b/builtin-grep.c
index 6a240fb6e9..2e7986cece 100644
--- a/builtin-grep.c
+++ b/builtin-grep.c
@@ -29,10 +29,11 @@ static int pathspec_matches(const char **paths, const char *name)
int matchlen = strlen(match);
const char *cp, *meta;
- if ((matchlen <= namelen) &&
- !strncmp(name, match, matchlen) &&
- (match[matchlen-1] == '/' ||
- name[matchlen] == '\0' || name[matchlen] == '/'))
+ if (!matchlen ||
+ ((matchlen <= namelen) &&
+ !strncmp(name, match, matchlen) &&
+ (match[matchlen-1] == '/' ||
+ name[matchlen] == '\0' || name[matchlen] == '/')))
return 1;
if (!fnmatch(match, name, 0))
return 1;