VirtualBox

Ignore:
Timestamp:
Sep 11, 2019 8:46:37 AM (5 years ago)
Author:
vboxsync
Message:

Devices/EFI/FirmwareNew: Start upgrade process to edk2-stable201908 (compiles on Windows and works to some extent), bugref:4643

Location:
trunk/src/VBox/Devices/EFI/FirmwareNew
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/EFI/FirmwareNew

  • trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/DnsDxe/DnsImpl.c

    r77662 r80721  
    22DnsDxe support functions implementation.
    33
    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.
     4Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR>
     5SPDX-License-Identifier: BSD-2-Clause-Patent
    126
    137**/
     
    11151109  @param  Instance              The DNS instance
    11161110  @param  RxString              Received buffer.
     1111  @param  Length                Received buffer length.
    11171112  @param  Completed             Flag to indicate that Dns response is valid.
    11181113
     
    11251120  IN OUT DNS_INSTANCE              *Instance,
    11261121  IN     UINT8                     *RxString,
     1122  IN     UINT32                    Length,
    11271123     OUT BOOLEAN                   *Completed
    11281124  )
     
    11311127
    11321128  CHAR8                 *QueryName;
     1129  UINT32                QueryNameLen;
    11331130  DNS_QUERY_SECTION     *QuerySection;
    11341131
     
    11561153
    11571154  EFI_STATUS            Status;
     1155  UINT32                RemainingLength;
    11581156
    11591157  EFI_TPL               OldTpl;
     
    11791177  *Completed       = TRUE;
    11801178  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  }
    11811190
    11821191  //
     
    11931202
    11941203  //
     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  //
    11951213  // Get Query name
    11961214  //
    11971215  QueryName = (CHAR8 *) (RxString + sizeof (*DnsHeader));
    11981216
     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
    11991229  //
    12001230  // Get query section
    12011231  //
    1202   QuerySection = (DNS_QUERY_SECTION *) (QueryName + AsciiStrLen (QueryName) + 1);
     1232  QuerySection = (DNS_QUERY_SECTION *) (QueryName + QueryNameLen);
    12031233  QuerySection->Type = NTOHS (QuerySection->Type);
    12041234  QuerySection->Class = NTOHS (QuerySection->Class);
    1205 
    1206   //
    1207   // Get Answer name
    1208   //
    1209   AnswerName = (CHAR8 *) QuerySection + sizeof (*QuerySection);
    12101235
    12111236  OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
     
    13431368
    13441369  //
     1370  // Get Answer name
     1371  //
     1372  AnswerName = (CHAR8 *) QuerySection + sizeof (*QuerySection);
     1373
     1374  //
    13451375  // Processing AnswerSection.
    13461376  //
    13471377  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
    13481389    //
    13491390    // Answer name should be PTR, else EFI_UNSUPPORTED returned.
     
    13621403    AnswerSection->Ttl = NTOHL (AnswerSection->Ttl);
    13631404    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    }
    13641416
    13651417    //
     
    17341786
    17351787  UINT8                     *RcvString;
     1788  UINT32                    Len;
    17361789
    17371790  BOOLEAN                   Completed;
     
    17491802  ASSERT (Packet != NULL);
    17501803
    1751   if (Packet->TotalSize <= sizeof (DNS_HEADER)) {
    1752     goto ON_EXIT;
    1753   }
     1804  Len = Packet->TotalSize;
    17541805
    17551806  RcvString = NetbufGetByte (Packet, 0, NULL);
     
    17591810  // Parse Dns Response
    17601811  //
    1761   ParseDnsResponse (Instance, RcvString, &Completed);
     1812  ParseDnsResponse (Instance, RcvString, Len, &Completed);
    17621813
    17631814ON_EXIT:
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette