diff options
author | Jiaxin Wu <jiaxin.wu@intel.com> | 2018-01-17 11:25:41 +0800 |
---|---|---|
committer | Jiaxin Wu <jiaxin.wu@intel.com> | 2018-01-25 13:40:26 +0800 |
commit | 6d005df6f76a51073cae08ad7968c9fc06cc0333 (patch) | |
tree | 1d09e59ddf3231155dcaf18f0c01022961874910 | |
parent | c99948a2d1ced0db8fdbb2e38083475efe8bb4ca (diff) | |
download | edk2-6d005df6f76a51073cae08ad7968c9fc06cc0333.zip edk2-6d005df6f76a51073cae08ad7968c9fc06cc0333.tar.gz edk2-6d005df6f76a51073cae08ad7968c9fc06cc0333.tar.bz2 |
NetworkPkg/HttpBootDxe: Avoid to corrupt HttpBootDxe setup screen.
When giving an invalid URI in Boot URI field within HTTP Boot
configuration page, the AsciiPrint will corrupt the setup screen.
This patch is to resolve the issue.
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Karunakar P <karunakarp@amiindia.co.in>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
(cherry picked from commit 7ee089f604a17b839c290b5481d8e5101cf85c03)
-rw-r--r-- | NetworkPkg/HttpBootDxe/HttpBootClient.c | 10 | ||||
-rw-r--r-- | NetworkPkg/HttpBootDxe/HttpBootSupport.c | 2 |
2 files changed, 10 insertions, 2 deletions
diff --git a/NetworkPkg/HttpBootDxe/HttpBootClient.c b/NetworkPkg/HttpBootDxe/HttpBootClient.c index 5c87171..15e0ab9 100644 --- a/NetworkPkg/HttpBootDxe/HttpBootClient.c +++ b/NetworkPkg/HttpBootDxe/HttpBootClient.c @@ -238,6 +238,11 @@ HttpBootDhcp4ExtractUriInfo ( Status = HttpBootCheckUriScheme (Private->BootFileUri);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "HttpBootDhcp4ExtractUriInfo: %r.\n", Status));
+ if (Status == EFI_INVALID_PARAMETER) {
+ AsciiPrint ("\n Error: Invalid URI address.\n");
+ } else if (Status == EFI_ACCESS_DENIED) {
+ AsciiPrint ("\n Error: Access forbidden, only HTTPS connection is allowed.\n");
+ }
return Status;
}
@@ -373,6 +378,11 @@ HttpBootDhcp6ExtractUriInfo ( Status = HttpBootCheckUriScheme (Private->BootFileUri);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "HttpBootDhcp6ExtractUriInfo: %r.\n", Status));
+ if (Status == EFI_INVALID_PARAMETER) {
+ AsciiPrint ("\n Error: Invalid URI address.\n");
+ } else if (Status == EFI_ACCESS_DENIED) {
+ AsciiPrint ("\n Error: Access forbidden, only HTTPS connection is allowed.\n");
+ }
return Status;
}
diff --git a/NetworkPkg/HttpBootDxe/HttpBootSupport.c b/NetworkPkg/HttpBootDxe/HttpBootSupport.c index 7ca48f3..d508e2c 100644 --- a/NetworkPkg/HttpBootDxe/HttpBootSupport.c +++ b/NetworkPkg/HttpBootDxe/HttpBootSupport.c @@ -1093,7 +1093,6 @@ HttpBootCheckUriScheme ( // Return EFI_INVALID_PARAMETER if the URI is not HTTP or HTTPS.
//
if ((AsciiStrnCmp (Uri, "http://", 7) != 0) && (AsciiStrnCmp (Uri, "https://", 8) != 0)) {
- AsciiPrint ("\n Error: Invalid URI address.\n");
DEBUG ((EFI_D_ERROR, "HttpBootCheckUriScheme: Invalid Uri.\n"));
return EFI_INVALID_PARAMETER;
}
@@ -1102,7 +1101,6 @@ HttpBootCheckUriScheme ( // HTTP is disabled, return EFI_ACCESS_DENIED if the URI is HTTP.
//
if (!PcdGetBool (PcdAllowHttpConnections) && (AsciiStrnCmp (Uri, "http://", 7) == 0)) {
- AsciiPrint ("\n Error: Access forbidden, only HTTPS connection is allowed.\n");
DEBUG ((EFI_D_ERROR, "HttpBootCheckUriScheme: HTTP is disabled.\n"));
return EFI_ACCESS_DENIED;
}
|