Validate the input namespace field to avoid assert.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18239 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Eric Dong 2015-08-20 00:22:16 +00:00 committed by ydong10
parent 9946c0a93e
commit e74c427978
1 changed files with 18 additions and 2 deletions

View File

@ -2850,8 +2850,17 @@ EfiConfigKeywordHandlerSetData (
Status = ExtractNameSpace (StringPtr, &NameSpace, &NextStringPtr);
if (EFI_ERROR (Status)) {
*ProgressErr = KEYWORD_HANDLER_MALFORMED_STRING;
return Status;
goto Done;
}
//
// 1.1 Check whether the input namespace is valid.
//
if (AsciiStrnCmp(NameSpace, UEFI_CONFIG_LANG, AsciiStrLen (UEFI_CONFIG_LANG)) != 0) {
*ProgressErr = KEYWORD_HANDLER_UNDEFINED_PROCESSING_ERROR;
Status = EFI_INVALID_PARAMETER;
goto Done;
}
StringPtr = NextStringPtr;
//
@ -3124,7 +3133,14 @@ EfiConfigKeywordHandlerGetData (
*ProgressErr = KEYWORD_HANDLER_NAMESPACE_ID_NOT_FOUND;
return Status;
}
//
// 1.1 Check whether the input namespace is valid.
//
if (AsciiStrnCmp(NameSpace, UEFI_CONFIG_LANG, AsciiStrLen (UEFI_CONFIG_LANG)) != 0) {
*ProgressErr = KEYWORD_HANDLER_UNDEFINED_PROCESSING_ERROR;
return EFI_INVALID_PARAMETER;
}
if (KeywordString != NULL) {
//
// Use temp string to avoid changing input string buffer.