mirror of https://github.com/ipxe/ipxe.git
[smbios] Fix SMBIOS string fetching
A bug in read_smbios_string() was causing the starting offset of the SMBIOS structure to be added twice, resulting in completely the wrong strings being returned. Bug identified by Martin Herweg <m.herweg@gmx.de>pull/1/head
parent
c3811d4a13
commit
031b30898a
|
@ -275,14 +275,12 @@ int read_smbios_string ( struct smbios_structure *structure,
|
||||||
* smbios_strings struct is constructed so as to
|
* smbios_strings struct is constructed so as to
|
||||||
* always end on a string boundary.
|
* always end on a string boundary.
|
||||||
*/
|
*/
|
||||||
string_len = strlen_user ( smbios.address,
|
string_len = strlen_user ( smbios.address, offset );
|
||||||
( structure->offset + offset ) );
|
|
||||||
if ( --index == 0 ) {
|
if ( --index == 0 ) {
|
||||||
/* Copy string, truncating as necessary. */
|
/* Copy string, truncating as necessary. */
|
||||||
if ( len > string_len )
|
if ( len > string_len )
|
||||||
len = string_len;
|
len = string_len;
|
||||||
copy_from_user ( data, smbios.address,
|
copy_from_user ( data, smbios.address, offset, len );
|
||||||
( structure->offset + offset ), len );
|
|
||||||
return string_len;
|
return string_len;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue