src/section_config.rs: do not allow control characters
This commit is contained in:
parent
7e7b781a18
commit
f51420ba1f
|
@ -139,9 +139,11 @@ impl SectionConfig {
|
||||||
if let Err(err) = parse_simple_value(§ion_id, &self.id_schema) {
|
if let Err(err) = parse_simple_value(§ion_id, &self.id_schema) {
|
||||||
bail!("syntax error in section identifier: {}", err.to_string());
|
bail!("syntax error in section identifier: {}", err.to_string());
|
||||||
}
|
}
|
||||||
|
if section_id.chars().any(|c| c.is_control()) {
|
||||||
|
bail!("detected unexpected control character in section ID.");
|
||||||
|
}
|
||||||
|
|
||||||
verify_json_object(section_config, &plugin.properties)?;
|
verify_json_object(section_config, &plugin.properties)?;
|
||||||
println!("REAL WRITE {} {} {:?}\n", section_id, type_name, section_config);
|
|
||||||
|
|
||||||
let head = (self.format_section_header)(type_name, section_id, section_config);
|
let head = (self.format_section_header)(type_name, section_id, section_config);
|
||||||
|
|
||||||
|
@ -159,6 +161,9 @@ impl SectionConfig {
|
||||||
bail!("got unsupported type in section '{}' key '{}'", section_id, key);
|
bail!("got unsupported type in section '{}' key '{}'", section_id, key);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
if text.chars().any(|c| c.is_control()) {
|
||||||
|
bail!("detected unexpected control character in section '{}' key '{}'", section_id, key);
|
||||||
|
}
|
||||||
raw += "\t";
|
raw += "\t";
|
||||||
raw += &key;
|
raw += &key;
|
||||||
raw += " ";
|
raw += " ";
|
||||||
|
|
Loading…
Reference in New Issue