summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@osdl.org>2005-10-11 15:24:11 -0700
committerJunio C Hamano <junkio@cox.net>2005-10-11 15:24:11 -0700
commit5cbb401dbaff5fd810a85b84333cb0c22d264f36 (patch)
tree8c8a7c6987bcb0eeab559a58170fccd767ce0218 /config.c
parent013f276eb78967f9742654ebde303c2fbe7a6cd6 (diff)
downloadgit-5cbb401dbaff5fd810a85b84333cb0c22d264f36.tar.gz
Improve config file escape sanity checking
I had meant to disallow unknown escape characters in the config file parser, but instead an unknown escaped character would silently pass through as itself. That's correct for some cases (notably '\' itself), but wasn't correct in general. This fixes it, and makes the parser write a nice error message if the config file contains bogus escaped characters. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'config.c')
-rw-r--r--config.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/config.c b/config.c
index f3c4fa42ac..510456ceb5 100644
--- a/config.c
+++ b/config.c
@@ -64,7 +64,12 @@ static char *parse_value(void)
case 'n':
c = '\n';
break;
- return NULL;
+ /* Some characters escape as themselves */
+ case '\\': case '"':
+ break;
+ /* Reject unknown escape sequences */
+ default:
+ return NULL;
}
value[len++] = c;
continue;