summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@elego.de>2011-05-31 15:16:25 +0200
committerCarlos Martín Nieto <cmn@elego.de>2011-05-31 17:33:24 +0200
commit5892277cd04bb9ed0dee5bea5fdf96f95aac0a8a (patch)
treebd0628afa2f77bd1acf3d899bc7ea7a5d7bb8749 /src
parent7288d8b65c5f584f14eff045ab2f70a97a666898 (diff)
downloadlibgit2-5892277cd04bb9ed0dee5bea5fdf96f95aac0a8a.tar.gz
Config parse header ext: don't allow text after closing quote
Nothing is allowed betwen the closing quotation mark and the ] so return an error if there is. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Diffstat (limited to 'src')
-rw-r--r--src/config_file.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/config_file.c b/src/config_file.c
index 4b7ce069e..57611a762 100644
--- a/src/config_file.c
+++ b/src/config_file.c
@@ -595,12 +595,15 @@ static int parse_section_header_ext(const char *line, const char *base_name, cha
* added to the string. In case of error, jump to out
*/
do {
+ if (quote_marks == 2) {
+ error = git__throw(GIT_EOBJCORRUPTED, "Falied to parse ext header. Text after closing quote");
+ goto out;
+
+ }
+
switch (c) {
case '"':
- if (quote_marks++ >= 2) {
- error = git__throw(GIT_EOBJCORRUPTED, "Failed to parse ext header. Too many quotes");
- goto out;
- }
+ ++quote_marks;
break;
case '\\':
c = line[rpos++];
@@ -612,6 +615,7 @@ static int parse_section_header_ext(const char *line, const char *base_name, cha
error = git__throw(GIT_EOBJCORRUPTED, "Failed to parse ext header. Unsupported escape char \\%c", c);
goto out;
}
+ break;
default:
break;
}