Code

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 3606419f9e96e0f4bd33de08c4d64a3f30d2fb4c..2fab34754e0c176c5ae97e697b5969fdd361c4f8 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;