File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -143,8 +143,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
143143
144144 let dev = match (
145145 file_type,
146- matches. get_one :: < u64 > ( options:: MAJOR ) ,
147- matches. get_one :: < u64 > ( options:: MINOR ) ,
146+ matches. get_one :: < u32 > ( options:: MAJOR ) ,
147+ matches. get_one :: < u32 > ( options:: MINOR ) ,
148148 ) {
149149 ( FileType :: Fifo , None , None ) => 0 ,
150150 ( FileType :: Fifo , _, _) => {
@@ -208,13 +208,13 @@ pub fn uu_app() -> Command {
208208 Arg :: new ( options:: MAJOR )
209209 . value_name ( options:: MAJOR )
210210 . help ( translate ! ( "mknod-help-major" ) )
211- . value_parser ( value_parser ! ( u64 ) ) ,
211+ . value_parser ( value_parser ! ( u32 ) ) ,
212212 )
213213 . arg (
214214 Arg :: new ( options:: MINOR )
215215 . value_name ( options:: MINOR )
216216 . help ( translate ! ( "mknod-help-minor" ) )
217- . value_parser ( value_parser ! ( u64 ) ) ,
217+ . value_parser ( value_parser ! ( u32 ) ) ,
218218 )
219219 . arg (
220220 Arg :: new ( options:: SECURITY_CONTEXT )
Original file line number Diff line number Diff line change @@ -14,6 +14,19 @@ use uutests::util::TestScenario;
1414use uutests:: util:: run_ucmd_as_root;
1515use uutests:: util_name;
1616
17+ //Reject 2^32+1 major/minor device number
18+ #[ test]
19+ fn test_mknod_overflow_major_minor ( ) {
20+ new_ucmd ! ( )
21+ . arg ( "lg32" )
22+ . arg ( "c" )
23+ . arg ( "4294967296" )
24+ . arg ( "1" )
25+ . fails_with_code ( 1 )
26+ . no_stdout ( )
27+ . stderr_contains ( "invalid value '4294967296'" ) ; //clap generated message, thats fine.
28+ }
29+
1730#[ test]
1831fn test_mknod_invalid_arg ( ) {
1932 new_ucmd ! ( )
You can’t perform that action at this time.
0 commit comments