mirror of https://github.com/acidanthera/audk.git
MdeModulePkg Variable: Use comparison logic to check UINTN parameter
Commit 180ac200da
changes the input parameter
from BOOLEAN to UINTN. Its comparison logic should be updated.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
This commit is contained in:
parent
2e3daaf688
commit
051bf6e0af
|
@ -3,7 +3,7 @@
|
||||||
Emulation Variable services operate on the runtime volatile memory.
|
Emulation Variable services operate on the runtime volatile memory.
|
||||||
The nonvolatile variable space doesn't exist.
|
The nonvolatile variable space doesn't exist.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -546,8 +546,8 @@ GetLangFromSupportedLangCodes (
|
||||||
@param[in] SupportedLanguages A pointer to a Null-terminated ASCII string that
|
@param[in] SupportedLanguages A pointer to a Null-terminated ASCII string that
|
||||||
contains a set of language codes in the format
|
contains a set of language codes in the format
|
||||||
specified by Iso639Language.
|
specified by Iso639Language.
|
||||||
@param[in] Iso639Language If TRUE, then all language codes are assumed to be
|
@param[in] Iso639Language If not zero, then all language codes are assumed to be
|
||||||
in ISO 639-2 format. If FALSE, then all language
|
in ISO 639-2 format. If zero, then all language
|
||||||
codes are assumed to be in RFC 4646 language format
|
codes are assumed to be in RFC 4646 language format
|
||||||
@param[in] ... A variable argument list that contains pointers to
|
@param[in] ... A variable argument list that contains pointers to
|
||||||
Null-terminated ASCII strings that contain one or more
|
Null-terminated ASCII strings that contain one or more
|
||||||
|
@ -599,7 +599,7 @@ VariableGetBestLanguage (
|
||||||
//
|
//
|
||||||
// If in RFC 4646 mode, then determine the length of the first RFC 4646 language code in Language
|
// If in RFC 4646 mode, then determine the length of the first RFC 4646 language code in Language
|
||||||
//
|
//
|
||||||
if (!Iso639Language) {
|
if (Iso639Language == 0) {
|
||||||
for (LanguageLength = 0; Language[LanguageLength] != 0 && Language[LanguageLength] != ';'; LanguageLength++);
|
for (LanguageLength = 0; Language[LanguageLength] != 0 && Language[LanguageLength] != ';'; LanguageLength++);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -614,7 +614,7 @@ VariableGetBestLanguage (
|
||||||
//
|
//
|
||||||
// In RFC 4646 mode, then Loop through all language codes in SupportedLanguages
|
// In RFC 4646 mode, then Loop through all language codes in SupportedLanguages
|
||||||
//
|
//
|
||||||
if (!Iso639Language) {
|
if (Iso639Language == 0) {
|
||||||
//
|
//
|
||||||
// Skip ';' characters in Supported
|
// Skip ';' characters in Supported
|
||||||
//
|
//
|
||||||
|
@ -636,13 +636,13 @@ VariableGetBestLanguage (
|
||||||
if (AsciiStrnCmp (Supported, Language, LanguageLength) == 0) {
|
if (AsciiStrnCmp (Supported, Language, LanguageLength) == 0) {
|
||||||
VA_END (Args);
|
VA_END (Args);
|
||||||
|
|
||||||
Buffer = Iso639Language ? mVariableModuleGlobal->Lang : mVariableModuleGlobal->PlatformLang;
|
Buffer = (Iso639Language != 0) ? mVariableModuleGlobal->Lang : mVariableModuleGlobal->PlatformLang;
|
||||||
Buffer[CompareLength] = '\0';
|
Buffer[CompareLength] = '\0';
|
||||||
return CopyMem (Buffer, Supported, CompareLength);
|
return CopyMem (Buffer, Supported, CompareLength);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Iso639Language) {
|
if (Iso639Language != 0) {
|
||||||
//
|
//
|
||||||
// If ISO 639 mode, then each language can only be tested once
|
// If ISO 639 mode, then each language can only be tested once
|
||||||
//
|
//
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
VariableServiceSetVariable() should also check authenticate data to avoid buffer overflow,
|
VariableServiceSetVariable() should also check authenticate data to avoid buffer overflow,
|
||||||
integer overflow. It should also check attribute to avoid authentication bypass.
|
integer overflow. It should also check attribute to avoid authentication bypass.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
(C) Copyright 2015-2018 Hewlett Packard Enterprise Development LP<BR>
|
(C) Copyright 2015-2018 Hewlett Packard Enterprise Development LP<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
@ -1533,8 +1533,8 @@ GetLangFromSupportedLangCodes (
|
||||||
@param[in] SupportedLanguages A pointer to a Null-terminated ASCII string that
|
@param[in] SupportedLanguages A pointer to a Null-terminated ASCII string that
|
||||||
contains a set of language codes in the format
|
contains a set of language codes in the format
|
||||||
specified by Iso639Language.
|
specified by Iso639Language.
|
||||||
@param[in] Iso639Language If TRUE, then all language codes are assumed to be
|
@param[in] Iso639Language If not zero, then all language codes are assumed to be
|
||||||
in ISO 639-2 format. If FALSE, then all language
|
in ISO 639-2 format. If zero, then all language
|
||||||
codes are assumed to be in RFC 4646 language format
|
codes are assumed to be in RFC 4646 language format
|
||||||
@param[in] ... A variable argument list that contains pointers to
|
@param[in] ... A variable argument list that contains pointers to
|
||||||
Null-terminated ASCII strings that contain one or more
|
Null-terminated ASCII strings that contain one or more
|
||||||
|
@ -1588,7 +1588,7 @@ VariableGetBestLanguage (
|
||||||
//
|
//
|
||||||
// If in RFC 4646 mode, then determine the length of the first RFC 4646 language code in Language
|
// If in RFC 4646 mode, then determine the length of the first RFC 4646 language code in Language
|
||||||
//
|
//
|
||||||
if (!Iso639Language) {
|
if (Iso639Language == 0) {
|
||||||
for (LanguageLength = 0; Language[LanguageLength] != 0 && Language[LanguageLength] != ';'; LanguageLength++);
|
for (LanguageLength = 0; Language[LanguageLength] != 0 && Language[LanguageLength] != ';'; LanguageLength++);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1603,7 +1603,7 @@ VariableGetBestLanguage (
|
||||||
//
|
//
|
||||||
// In RFC 4646 mode, then Loop through all language codes in SupportedLanguages
|
// In RFC 4646 mode, then Loop through all language codes in SupportedLanguages
|
||||||
//
|
//
|
||||||
if (!Iso639Language) {
|
if (Iso639Language == 0) {
|
||||||
//
|
//
|
||||||
// Skip ';' characters in Supported
|
// Skip ';' characters in Supported
|
||||||
//
|
//
|
||||||
|
@ -1625,13 +1625,13 @@ VariableGetBestLanguage (
|
||||||
if (AsciiStrnCmp (Supported, Language, LanguageLength) == 0) {
|
if (AsciiStrnCmp (Supported, Language, LanguageLength) == 0) {
|
||||||
VA_END (Args);
|
VA_END (Args);
|
||||||
|
|
||||||
Buffer = Iso639Language ? mVariableModuleGlobal->Lang : mVariableModuleGlobal->PlatformLang;
|
Buffer = (Iso639Language != 0) ? mVariableModuleGlobal->Lang : mVariableModuleGlobal->PlatformLang;
|
||||||
Buffer[CompareLength] = '\0';
|
Buffer[CompareLength] = '\0';
|
||||||
return CopyMem (Buffer, Supported, CompareLength);
|
return CopyMem (Buffer, Supported, CompareLength);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Iso639Language) {
|
if (Iso639Language != 0) {
|
||||||
//
|
//
|
||||||
// If ISO 639 mode, then each language can only be tested once
|
// If ISO 639 mode, then each language can only be tested once
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue