mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-21 20:14:44 +00:00
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>
This commit is contained in:
parent
7288d8b65c
commit
5892277cd0
@ -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
|
* added to the string. In case of error, jump to out
|
||||||
*/
|
*/
|
||||||
do {
|
do {
|
||||||
|
if (quote_marks == 2) {
|
||||||
|
error = git__throw(GIT_EOBJCORRUPTED, "Falied to parse ext header. Text after closing quote");
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case '"':
|
case '"':
|
||||||
if (quote_marks++ >= 2) {
|
++quote_marks;
|
||||||
error = git__throw(GIT_EOBJCORRUPTED, "Failed to parse ext header. Too many quotes");
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case '\\':
|
case '\\':
|
||||||
c = line[rpos++];
|
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);
|
error = git__throw(GIT_EOBJCORRUPTED, "Failed to parse ext header. Unsupported escape char \\%c", c);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user