Changeset 80721 in vbox for trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/DnsDxe/DnsImpl.c
- Timestamp:
- Sep 11, 2019 8:46:37 AM (5 years ago)
- Location:
- trunk/src/VBox/Devices/EFI/FirmwareNew
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/FirmwareNew
-
Property svn:mergeinfo
changed from (toggle deleted branches)
to (toggle deleted branches)/vendor/edk2/current 103735-103757,103769-103776,129194-129237 /vendor/edk2/current 103735-103757,103769-103776,129194-133213
-
Property svn:mergeinfo
changed from (toggle deleted branches)
-
trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/DnsDxe/DnsImpl.c
r77662 r80721 2 2 DnsDxe support functions implementation. 3 3 4 Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 http://opensource.org/licenses/bsd-license.php 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 4 Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR> 5 SPDX-License-Identifier: BSD-2-Clause-Patent 12 6 13 7 **/ … … 1115 1109 @param Instance The DNS instance 1116 1110 @param RxString Received buffer. 1111 @param Length Received buffer length. 1117 1112 @param Completed Flag to indicate that Dns response is valid. 1118 1113 … … 1125 1120 IN OUT DNS_INSTANCE *Instance, 1126 1121 IN UINT8 *RxString, 1122 IN UINT32 Length, 1127 1123 OUT BOOLEAN *Completed 1128 1124 ) … … 1131 1127 1132 1128 CHAR8 *QueryName; 1129 UINT32 QueryNameLen; 1133 1130 DNS_QUERY_SECTION *QuerySection; 1134 1131 … … 1156 1153 1157 1154 EFI_STATUS Status; 1155 UINT32 RemainingLength; 1158 1156 1159 1157 EFI_TPL OldTpl; … … 1179 1177 *Completed = TRUE; 1180 1178 Status = EFI_SUCCESS; 1179 RemainingLength = Length; 1180 1181 // 1182 // Check whether the remaining packet length is avaiable or not. 1183 // 1184 if (RemainingLength <= sizeof (DNS_HEADER)) { 1185 *Completed = FALSE; 1186 return EFI_ABORTED; 1187 } else { 1188 RemainingLength -= sizeof (DNS_HEADER); 1189 } 1181 1190 1182 1191 // … … 1193 1202 1194 1203 // 1204 // There is always one QuestionsNum in DNS message. The capability to handle more 1205 // than one requires to redesign the message format. Currently, it's not supported. 1206 // 1207 if (DnsHeader->QuestionsNum > 1) { 1208 *Completed = FALSE; 1209 return EFI_UNSUPPORTED; 1210 } 1211 1212 // 1195 1213 // Get Query name 1196 1214 // 1197 1215 QueryName = (CHAR8 *) (RxString + sizeof (*DnsHeader)); 1198 1216 1217 QueryNameLen = (UINT32) AsciiStrLen (QueryName) + 1; 1218 1219 // 1220 // Check whether the remaining packet length is avaiable or not. 1221 // 1222 if (RemainingLength <= QueryNameLen + sizeof (DNS_QUERY_SECTION)) { 1223 *Completed = FALSE; 1224 return EFI_ABORTED; 1225 } else { 1226 RemainingLength -= (QueryNameLen + sizeof (DNS_QUERY_SECTION)); 1227 } 1228 1199 1229 // 1200 1230 // Get query section 1201 1231 // 1202 QuerySection = (DNS_QUERY_SECTION *) (QueryName + AsciiStrLen (QueryName) + 1);1232 QuerySection = (DNS_QUERY_SECTION *) (QueryName + QueryNameLen); 1203 1233 QuerySection->Type = NTOHS (QuerySection->Type); 1204 1234 QuerySection->Class = NTOHS (QuerySection->Class); 1205 1206 //1207 // Get Answer name1208 //1209 AnswerName = (CHAR8 *) QuerySection + sizeof (*QuerySection);1210 1235 1211 1236 OldTpl = gBS->RaiseTPL (TPL_CALLBACK); … … 1343 1368 1344 1369 // 1370 // Get Answer name 1371 // 1372 AnswerName = (CHAR8 *) QuerySection + sizeof (*QuerySection); 1373 1374 // 1345 1375 // Processing AnswerSection. 1346 1376 // 1347 1377 while (AnswerSectionNum < DnsHeader->AnswersNum) { 1378 // 1379 // Check whether the remaining packet length is avaiable or not. 1380 // 1381 if (RemainingLength <= sizeof (UINT16) + sizeof (DNS_ANSWER_SECTION)) { 1382 *Completed = FALSE; 1383 Status = EFI_ABORTED; 1384 goto ON_EXIT; 1385 } else { 1386 RemainingLength -= (sizeof (UINT16) + sizeof (DNS_ANSWER_SECTION)); 1387 } 1388 1348 1389 // 1349 1390 // Answer name should be PTR, else EFI_UNSUPPORTED returned. … … 1362 1403 AnswerSection->Ttl = NTOHL (AnswerSection->Ttl); 1363 1404 AnswerSection->DataLength = NTOHS (AnswerSection->DataLength); 1405 1406 // 1407 // Check whether the remaining packet length is avaiable or not. 1408 // 1409 if (RemainingLength < AnswerSection->DataLength) { 1410 *Completed = FALSE; 1411 Status = EFI_ABORTED; 1412 goto ON_EXIT; 1413 } else { 1414 RemainingLength -= AnswerSection->DataLength; 1415 } 1364 1416 1365 1417 // … … 1734 1786 1735 1787 UINT8 *RcvString; 1788 UINT32 Len; 1736 1789 1737 1790 BOOLEAN Completed; … … 1749 1802 ASSERT (Packet != NULL); 1750 1803 1751 if (Packet->TotalSize <= sizeof (DNS_HEADER)) { 1752 goto ON_EXIT; 1753 } 1804 Len = Packet->TotalSize; 1754 1805 1755 1806 RcvString = NetbufGetByte (Packet, 0, NULL); … … 1759 1810 // Parse Dns Response 1760 1811 // 1761 ParseDnsResponse (Instance, RcvString, &Completed);1812 ParseDnsResponse (Instance, RcvString, Len, &Completed); 1762 1813 1763 1814 ON_EXIT:
Note:
See TracChangeset
for help on using the changeset viewer.