mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-12 09:54:36 +01:00
Add some XString length test.
This commit is contained in:
parent
f6903b7579
commit
3a742b5dbc
@ -2613,7 +2613,7 @@ GetEarlyUserSettings (
|
||||
gSettings.KernelScan = KERNEL_SCAN_NONE;
|
||||
} else if ((Dict2->type == kTagTypeString) && Dict2->string.notEmpty() ) {
|
||||
if ((Dict2->string[0] == 'N') || (Dict2->string[0] == 'n')) {
|
||||
gSettings.KernelScan = ((Dict2->string[1] == 'E') || (Dict2->string[1] == 'e')) ? KERNEL_SCAN_NEWEST : KERNEL_SCAN_NONE;
|
||||
gSettings.KernelScan = ( Dict2->string.length() > 1 && (Dict2->string[1] == 'E' || Dict2->string[1] == 'e') ) ? KERNEL_SCAN_NEWEST : KERNEL_SCAN_NONE;
|
||||
} else if ((Dict2->string[0] == 'O') || (Dict2->string[0] == 'o')) {
|
||||
gSettings.KernelScan = KERNEL_SCAN_OLDEST;
|
||||
} else if ((Dict2->string[0] == 'F') || (Dict2->string[0] == 'f')) {
|
||||
@ -4830,11 +4830,12 @@ GetUserSettings(
|
||||
gSettings.HDALayoutId = (INT32)Prop->intValue; //must be signed
|
||||
gSettings.HDAInjection = (gSettings.HDALayoutId > 0);
|
||||
} else if (Prop->type == kTagTypeString){
|
||||
if ((Prop->string[0] == 'n') || (Prop->string[0] == 'N')) {
|
||||
if ( Prop->string.length() > 0 && (Prop->string[0] == 'n' || Prop->string[0] == 'N') ) {
|
||||
// if starts with n or N, then no HDA injection
|
||||
gSettings.HDAInjection = FALSE;
|
||||
} else if ((Prop->string[0] == '0') &&
|
||||
(Prop->string[1] == 'x' || Prop->string[1] == 'X')) {
|
||||
} else if ( Prop->string.length() > 1 &&
|
||||
Prop->string[0] == '0' &&
|
||||
( Prop->string[1] == 'x' || Prop->string[1] == 'X' ) ) {
|
||||
// assume it's a hex layout id
|
||||
gSettings.HDALayoutId = (INT32)AsciiStrHexToUintn(Prop->string);
|
||||
gSettings.HDAInjection = TRUE;
|
||||
|
@ -1022,7 +1022,7 @@ GetPropertyInteger(
|
||||
if (Prop->type == kTagTypeInteger) {
|
||||
return Prop->intValue; //this is union char* or size_t
|
||||
} else if ((Prop->type == kTagTypeString) && Prop->string.notEmpty()) {
|
||||
if ( Prop->string.length() > 2 && (Prop->string[1] == 'x' || Prop->string[1] == 'X') ) {
|
||||
if ( Prop->string.length() > 1 && (Prop->string[1] == 'x' || Prop->string[1] == 'X') ) {
|
||||
return (INTN)AsciiStrHexToUintn(Prop->string);
|
||||
}
|
||||
|
||||
|
@ -961,12 +961,7 @@ static EFI_STATUS ScanVolume(IN OUT REFIT_VOLUME *Volume)
|
||||
FreePool(RootInfo);
|
||||
}
|
||||
}
|
||||
if (
|
||||
Volume->VolName.isEmpty()
|
||||
|| Volume->VolName[0] == 0
|
||||
|| (Volume->VolName[0] == L'\\' && Volume->VolName[1] == 0)
|
||||
|| (Volume->VolName[0] == L'/' && Volume->VolName[1] == 0)
|
||||
)
|
||||
if ( Volume->VolName.isEmpty() || Volume->VolName.equal("\\") || Volume->VolName.equal(L"/") )
|
||||
{
|
||||
VOID *Instance;
|
||||
if (!EFI_ERROR(gBS->HandleProtocol(Volume->DeviceHandle, &gEfiPartTypeSystemPartGuid, &Instance))) {
|
||||
|
Loading…
Reference in New Issue
Block a user