ocvalidate: More prompts for PickerVariant length
@@ -196,6 +196,9 @@ CheckMiscBoot (
BOOLEAN HasOpenCanopyEfiDriver;
CONST CHAR8 *PickerMode;
CONST CHAR8 *PickerVariant;
+ UINTN PVSumSize;
+ UINTN PVPathFixedSize;
+ UINTN MaxPickerVariantLen;
BOOLEAN IsPickerAudioAssistEnabled;
BOOLEAN IsAudioSupportEnabled;
CONST CHAR8 *LauncherOption;
@@ -256,8 +259,16 @@ CheckMiscBoot (
//
// There is one missing '\\' after the concatenation of PickerVariant and ExtAppleRecv10_15.icns (which has the longest length). Append one.
//
- if (L_STR_LEN (OPEN_CORE_IMAGE_PATH) + AsciiStrLen (PickerVariant) + 1 + L_STR_SIZE ("ExtAppleRecv10_15.icns") > OC_STORAGE_SAFE_PATH_MAX) {
- DEBUG ((DEBUG_WARN, "Misc->Boot->PickerVariant is too long (should not exceed %u)!\n", OC_STORAGE_SAFE_PATH_MAX));
+ PVPathFixedSize = L_STR_LEN (OPEN_CORE_IMAGE_PATH) + 1 + L_STR_SIZE ("ExtAppleRecv10_15.icns");
+ PVSumSize = PVPathFixedSize + AsciiStrLen (PickerVariant);
+ if (PVSumSize > OC_STORAGE_SAFE_PATH_MAX) {
+ MaxPickerVariantLen = OC_STORAGE_SAFE_PATH_MAX - PVPathFixedSize;
+ DEBUG ((
+ DEBUG_WARN,
+ "Misc->Boot->PickerVariant (length %u) is too long (should not exceed %u)!\n",
+ AsciiStrLen (PickerVariant),
+ MaxPickerVariantLen
+ ));
++ErrorCount;
}
