# Fix silly pathspec bug in git-ls-files

1 messages from 2005-08-24 to 2005-08-24. Participants: Linus Torvalds.
Thread: https://gitlist.dev/t/1632

## Linus Torvalds, 2005-08-24 00:14

Subject: Fix silly pathspec bug in git-ls-files
Message-ID: <Pine.LNX.4.58.0508231711350.3317@g5.osdl.org>
URL: https://gitlist.dev/e/Pine.LNX.4.58.0508231711350.3317%40g5.osdl.org

```

The "verify_pathspec()" function doesn't test for ending NUL character in 
the pathspec, causing some really funky and unexpected behaviour. It just 
happened to work in the cases I had tested.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
---
diff --git a/ls-files.c b/ls-files.c
--- a/ls-files.c
+++ b/ls-files.c
@@ -496,7 +496,7 @@ static void verify_pathspec(void)
 			char c = n[i];
 			if (prev && prev[i] != c)
 				break;
-			if (c == '*' || c == '?')
+			if (!c || c == '*' || c == '?')
 				break;
 			if (c == '/')
 				len = i+1;

```
