File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -41,6 +41,9 @@ const PD_MAX_PRIORITY: u8 = 254;
4141/// In microseconds
4242const BUDGET_DEFAULT : u64 = 1000 ;
4343
44+ /// The maximum number of domains supported by the kernel
45+ const DOMAIN_COUNT_MAX : u64 = 256 ;
46+
4447/// The purpose of this function is to parse an integer that could
4548/// either be in decimal or hex format, unlike the normal parsing
4649/// functionality that the Rust standard library provides.
@@ -840,6 +843,12 @@ impl DomainSchedule {
840843 loc_string( xml_sdf, pos)
841844 ) ) ;
842845 }
846+ if domain_names. size ( ) > DOMAIN_COUNT_MAX {
847+ return Err ( format ! (
848+ "Error: number of domains in domain schedule exceeds maximum of 256: {}" ,
849+ loc_string( xml_sdf, pos)
850+ ) ) ;
851+ }
843852
844853 let time = checked_lookup ( xml_sdf, & child, "length" ) ?. parse :: < u64 > ( ) ;
845854 if let Err ( _) = time {
You can’t perform that action at this time.
0 commit comments