File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -141,7 +141,7 @@ impl EfiVariables {
141141 . join ( String :: new ( ) + prefix + & "-" + guid_bytes)
142142 . join ( "raw_var" ) ;
143143 let efi_variable = self . parse_payload ( & full_path) ?;
144- if * efi_variable. name != * name {
144+ if * efi_variable. name != * prefix {
145145 return Err :: < EfiVariable , Box < dyn Error > > ( "Corrupt variable. Reported name does not match name" . into ( ) ) ;
146146 }
147147 if efi_variable. guid != guid {
@@ -216,7 +216,13 @@ impl EfiVariables {
216216 fn get_firmware_platform_size ( path : & str ) -> Result < usize , Box < dyn Error > > {
217217 let result = match fs:: read ( path) {
218218 Ok ( bytes) => match String :: from_utf8 ( bytes) {
219- Ok ( chars) => return Ok ( usize:: from_str_radix ( & chars, 10 ) ?) ,
219+ Ok ( chars) => {
220+ let ws_index = match chars. find ( char:: is_whitespace) {
221+ Some ( index) => index,
222+ None => chars. len ( )
223+ } ;
224+ Ok ( usize:: from_str_radix ( & chars[ 0 ..ws_index] , 10 ) ?)
225+ }
220226 Err ( e) => Err ( e. into ( ) ) ,
221227 } ,
222228 Err ( e) => Err ( e. into ( ) ) ,
You can’t perform that action at this time.
0 commit comments