git-apply: when validating default names, check the final EOLN too
authorLinus Torvalds <torvalds@ppc970.osdl.org>
Thu, 26 May 2005 20:28:42 +0000 (13:28 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Thu, 26 May 2005 20:28:42 +0000 (13:28 -0700)
This means that filenames are totally unambiguous even if they
have spaces or tabs in them.

apply.c

diff --git a/apply.c b/apply.c
index 3606419..2fab347 100644 (file)
--- a/apply.c
+++ b/apply.c
@@ -381,7 +381,7 @@ static char *git_header_name(char *line)
                                if (c == '/')
                                        break;
                        }
-                       if (!memcmp(name, second, len)) {
+                       if (second[len] == '\n' && !memcmp(name, second, len)) {
                                char *ret = xmalloc(len + 1);
                                memcpy(ret, name, len);
                                ret[len] = 0;