diff options
author | Jiaxin Wu <jiaxin.wu@intel.com> | 2016-12-08 08:52:41 +0800 |
---|---|---|
committer | Jiaxin Wu <jiaxin.wu@intel.com> | 2016-12-26 16:55:57 +0800 |
commit | 0e5e7996c9366fd6f710963c6a414003fd5a95ec (patch) | |
tree | e6a0b4b38da7e91c5f4d3285789d9dc371bcb508 /NetworkPkg | |
parent | 3f31ea1b3d59c909734a8b709a0cfb761579981e (diff) | |
download | edk2-platforms-0e5e7996c9366fd6f710963c6a414003fd5a95ec.tar.xz |
NetworkPkg/DnsDxe: Fixed the assert issue in DnsDxe
Fix the DnsDxe assert issue when the incorrect answer message
received.
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Zhang Lubo <lubo.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Zhang Lubo <lubo.zhang@intel.com>
Diffstat (limited to 'NetworkPkg')
-rw-r--r-- | NetworkPkg/DnsDxe/DnsImpl.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/NetworkPkg/DnsDxe/DnsImpl.c b/NetworkPkg/DnsDxe/DnsImpl.c index 74deaa4330..794df1d728 100644 --- a/NetworkPkg/DnsDxe/DnsImpl.c +++ b/NetworkPkg/DnsDxe/DnsImpl.c @@ -1330,9 +1330,12 @@ ParseDnsResponse ( //
while (AnswerSectionNum < DnsHeader->AnswersNum) {
//
- // Answer name should be PTR.
+ // Answer name should be PTR, else EFI_UNSUPPORTED returned.
//
- ASSERT ((*(UINT8 *) AnswerName & 0xC0) == 0xC0);
+ if ((*(UINT8 *) AnswerName & 0xC0) != 0xC0) {
+ Status = EFI_UNSUPPORTED;
+ goto ON_EXIT;
+ }
//
// Get Answer section.
@@ -1408,7 +1411,12 @@ ParseDnsResponse ( //
// This is address entry, get Data.
//
- ASSERT (Dns4TokenEntry != NULL && AnswerSection->DataLength == 4);
+ ASSERT (Dns4TokenEntry != NULL);
+
+ if (AnswerSection->DataLength != 4) {
+ Status = EFI_ABORTED;
+ goto ON_EXIT;
+ }
HostAddr4 = Dns4TokenEntry->Token->RspData.H2AData->IpList;
AnswerData = (UINT8 *) AnswerSection + sizeof (*AnswerSection);
@@ -1462,7 +1470,12 @@ ParseDnsResponse ( //
// This is address entry, get Data.
//
- ASSERT (Dns6TokenEntry != NULL && AnswerSection->DataLength == 16);
+ ASSERT (Dns6TokenEntry != NULL);
+
+ if (AnswerSection->DataLength != 16) {
+ Status = EFI_ABORTED;
+ goto ON_EXIT;
+ }
HostAddr6 = Dns6TokenEntry->Token->RspData.H2AData->IpList;
AnswerData = (UINT8 *) AnswerSection + sizeof (*AnswerSection);
|