VirtualBox

Ignore:
Timestamp:
Apr 14, 2023 3:17:44 PM (22 months ago)
Author:
vboxsync
Message:

Devices/EFI/FirmwareNew: Update to edk2-stable202302 and make it build, 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/Ip4Dxe/Ip4Option.c

    r85718 r99404  
    88
    99#include "Ip4Impl.h"
    10 
    1110
    1211/**
     
    2524BOOLEAN
    2625Ip4OptionIsValid (
    27   IN UINT8                  *Option,
    28   IN UINT32                 OptionLen,
    29   IN BOOLEAN                Rcvd
     26  IN UINT8    *Option,
     27  IN UINT32   OptionLen,
     28  IN BOOLEAN  Rcvd
    3029  )
    3130{
    32   UINT32                    Cur;
    33   UINT32                    Len;
    34   UINT32                    Point;
     31  UINT32  Cur;
     32  UINT32  Len;
     33  UINT32  Point;
    3534
    36   Cur       = 0;
     35  Cur = 0;
    3736
    3837  while (Cur < OptionLen) {
    3938    switch (Option[Cur]) {
    40     case IP4_OPTION_NOP:
    41       Cur++;
    42       break;
     39      case IP4_OPTION_NOP:
     40        Cur++;
     41        break;
    4342
    44     case IP4_OPTION_EOP:
    45       Cur = OptionLen;
    46       break;
     43      case IP4_OPTION_EOP:
     44        Cur = OptionLen;
     45        break;
    4746
    48     case IP4_OPTION_LSRR:
    49     case IP4_OPTION_SSRR:
    50     case IP4_OPTION_RR:
    51       Len   = Option[Cur + 1];
    52       Point = Option[Cur + 2];
     47      case IP4_OPTION_LSRR:
     48      case IP4_OPTION_SSRR:
     49      case IP4_OPTION_RR:
     50        Len   = Option[Cur + 1];
     51        Point = Option[Cur + 2];
    5352
    54       //
    55       // SRR/RR options are formatted as |Type|Len|Point|Ip1|Ip2|...
    56       //
    57       if ((OptionLen - Cur < Len) || (Len < 3) || ((Len - 3) % 4 != 0)) {
    58         return FALSE;
    59       }
     53        //
     54        // SRR/RR options are formatted as |Type|Len|Point|Ip1|Ip2|...
     55        //
     56        if ((OptionLen - Cur < Len) || (Len < 3) || ((Len - 3) % 4 != 0)) {
     57          return FALSE;
     58        }
    6059
    61       if ((Point > Len + 1) || (Point % 4 != 0)) {
    62         return FALSE;
    63       }
     60        if ((Point > Len + 1) || (Point % 4 != 0)) {
     61          return FALSE;
     62        }
    6463
    65       //
    66       // The Point must point pass the last entry if the packet is received
    67       // by us. It must point to 4 if the packet is to be sent by us for
    68       // source route option.
    69       //
    70       if ((Option[Cur] != IP4_OPTION_RR) &&
    71           ((Rcvd && (Point != Len + 1)) || (!Rcvd && (Point != 4)))) {
     64        //
     65        // The Point must point pass the last entry if the packet is received
     66        // by us. It must point to 4 if the packet is to be sent by us for
     67        // source route option.
     68        //
     69        if ((Option[Cur] != IP4_OPTION_RR) &&
     70            ((Rcvd && (Point != Len + 1)) || (!Rcvd && (Point != 4))))
     71        {
     72          return FALSE;
     73        }
    7274
    73         return FALSE;
    74       }
     75        Cur += Len;
     76        break;
    7577
    76       Cur += Len;
    77       break;
     78      default:
     79        Len = Option[Cur + 1];
    7880
    79     default:
    80       Len = Option[Cur + 1];
     81        if ((OptionLen - Cur < Len) || (Len < 2)) {
     82          return FALSE;
     83        }
    8184
    82       if ((OptionLen - Cur < Len) || (Len < 2)) {
    83         return FALSE;
    84       }
    85 
    86       Cur = Cur + Len;
    87       break;
     85        Cur = Cur + Len;
     86        break;
    8887    }
    89 
    9088  }
    9189
    9290  return TRUE;
    9391}
    94 
    9592
    9693/**
     
    113110EFI_STATUS
    114111Ip4CopyOption (
    115   IN     UINT8              *Option,
    116   IN     UINT32             OptionLen,
    117   IN     BOOLEAN            FirstFragment,
    118   IN OUT UINT8              *Buf,           OPTIONAL
    119   IN OUT UINT32             *BufLen
     112  IN     UINT8    *Option,
     113  IN     UINT32   OptionLen,
     114  IN     BOOLEAN  FirstFragment,
     115  IN OUT UINT8    *Buf            OPTIONAL,
     116  IN OUT UINT32   *BufLen
    120117  )
    121118{
    122   UINT8                     OptBuf[40];
    123   UINT32                    Cur;
    124   UINT32                    Next;
    125   UINT8                     Type;
    126   UINT32                    Len;
     119  UINT8   OptBuf[40];
     120  UINT32  Cur;
     121  UINT32  Next;
     122  UINT8   Type;
     123  UINT32  Len;
    127124
    128125  ASSERT ((BufLen != NULL) && (OptionLen <= 40));
    129126
    130   Cur   = 0;
    131   Next  = 0;
     127  Cur  = 0;
     128  Next = 0;
    132129
    133130  while (Cur < OptionLen) {
    134     Type  = Option[Cur];
    135     Len   = Option[Cur + 1];
     131    Type = Option[Cur];
     132    Len  = Option[Cur + 1];
    136133
    137134    if (Type == IP4_OPTION_NOP) {
     
    143140      Next++;
    144141      Cur++;
    145 
    146142    } else if (Type == IP4_OPTION_EOP) {
    147143      //
     
    149145      //
    150146      break;
    151 
    152147    } else {
    153148      //
    154149      // don't copy options that is only valid for the first fragment
    155150      //
    156       if (FirstFragment || (Type & IP4_OPTION_COPY_MASK) != 0) {
     151      if (FirstFragment || ((Type & IP4_OPTION_COPY_MASK) != 0)) {
    157152        CopyMem (OptBuf + Next, Option + Cur, Len);
    158153        Next += Len;
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