Changeset 77662 in vbox for trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/Mtftp6Dxe
- Timestamp:
- Mar 12, 2019 12:40:12 PM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 129295
- Location:
- trunk/src/VBox/Devices/EFI/FirmwareNew
- Files:
-
- 4 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 /vendor/edk2/current 103735-103757,103769-103776,129194-129237
-
Property svn:mergeinfo
changed from (toggle deleted branches)
-
trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/Mtftp6Dxe/Mtftp6Dxe.uni
r58464 r77662 1 // /** @file1 // /** @file 2 2 // Client-side Mtftp6 service. 3 3 // -
trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/Mtftp6Dxe/Mtftp6DxeExtra.uni
r58464 r77662 1 // /** @file1 // /** @file 2 2 // Mtftp6Dxe Localized Strings and Content 3 3 // -
trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/Mtftp6Dxe/Mtftp6Support.c
r58459 r77662 2 2 Mtftp6 support functions implementation. 3 3 4 Copyright (c) 2009 - 201 2, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 224 224 225 225 if (Range->Round > 0) { 226 *TotalBlock += Range->Bound + MultU64x32 ( (UINT64) (Range->Round -1), (UINT32)(Range->Bound + 1)) + 1;226 *TotalBlock += Range->Bound + MultU64x32 (Range->Round - 1, (UINT32)(Range->Bound + 1)) + 1; 227 227 } 228 228 … … 320 320 321 321 if (!EFI_ERROR (Status)) { 322 if (Ip6Mode.AddressList != NULL) { 323 FreePool (Ip6Mode.AddressList); 324 } 325 326 if (Ip6Mode.GroupTable != NULL) { 327 FreePool (Ip6Mode.GroupTable); 328 } 329 330 if (Ip6Mode.RouteTable != NULL) { 331 FreePool (Ip6Mode.RouteTable); 332 } 333 334 if (Ip6Mode.NeighborCache != NULL) { 335 FreePool (Ip6Mode.NeighborCache); 336 } 337 338 if (Ip6Mode.PrefixTable != NULL) { 339 FreePool (Ip6Mode.PrefixTable); 340 } 341 342 if (Ip6Mode.IcmpTypeList != NULL) { 343 FreePool (Ip6Mode.IcmpTypeList); 344 } 322 345 323 346 if (Ip6Mode.IsConfigured) { … … 453 476 EFI_MTFTP6_OPTION *Options; 454 477 EFI_MTFTP6_TOKEN *Token; 478 RETURN_STATUS Status; 455 479 NET_BUF *Nbuf; 456 480 UINT8 *Mode; 457 481 UINT8 *Cur; 458 UINT32 Len1;459 UINT32 Len2;460 UINT32 Len;461 482 UINTN Index; 483 UINT32 BufferLength; 484 UINTN FileNameLength; 485 UINTN ModeLength; 486 UINTN OptionStrLength; 487 UINTN ValueStrLength; 462 488 463 489 Token = Instance->Token; … … 488 514 // Compute the size of new Mtftp6 packet. 489 515 // 490 Len1 = (UINT32)AsciiStrLen ((CHAR8 *) Token->Filename);491 Len2 = (UINT32)AsciiStrLen ((CHAR8 *) Mode);492 Len = Len1 + Len2+ 4;516 FileNameLength = AsciiStrLen ((CHAR8 *) Token->Filename); 517 ModeLength = AsciiStrLen ((CHAR8 *) Mode); 518 BufferLength = (UINT32) FileNameLength + (UINT32) ModeLength + 4; 493 519 494 520 for (Index = 0; Index < Token->OptionCount; Index++) { 495 Len1 = (UINT32)AsciiStrLen ((CHAR8 *) Options[Index].OptionStr);496 Len2 = (UINT32)AsciiStrLen ((CHAR8 *) Options[Index].ValueStr);497 Len += Len1 + Len2+ 2;521 OptionStrLength = AsciiStrLen ((CHAR8 *) Options[Index].OptionStr); 522 ValueStrLength = AsciiStrLen ((CHAR8 *) Options[Index].ValueStr); 523 BufferLength += (UINT32) OptionStrLength + (UINT32) ValueStrLength + 2; 498 524 } 499 525 … … 501 527 // Allocate a packet then copy the data. 502 528 // 503 if ((Nbuf = NetbufAlloc ( Len)) == NULL) {529 if ((Nbuf = NetbufAlloc (BufferLength)) == NULL) { 504 530 return EFI_OUT_OF_RESOURCES; 505 531 } … … 508 534 // Copy the opcode, filename and mode into packet. 509 535 // 510 Packet = (EFI_MTFTP6_PACKET *) NetbufAllocSpace (Nbuf, Len, FALSE);536 Packet = (EFI_MTFTP6_PACKET *) NetbufAllocSpace (Nbuf, BufferLength, FALSE); 511 537 ASSERT (Packet != NULL); 512 538 513 539 Packet->OpCode = HTONS (Operation); 540 BufferLength -= sizeof (Packet->OpCode); 541 514 542 Cur = Packet->Rrq.Filename; 515 Cur = (UINT8 *) AsciiStrCpy ((CHAR8 *) Cur, (CHAR8 *) Token->Filename); 516 Cur += AsciiStrLen ((CHAR8 *) Token->Filename) + 1; 517 Cur = (UINT8 *) AsciiStrCpy ((CHAR8 *) Cur, (CHAR8 *) Mode); 518 Cur += AsciiStrLen ((CHAR8 *) Mode) + 1; 543 Status = AsciiStrCpyS ((CHAR8 *) Cur, BufferLength, (CHAR8 *) Token->Filename); 544 ASSERT_EFI_ERROR (Status); 545 BufferLength -= (UINT32) (FileNameLength + 1); 546 Cur += FileNameLength + 1; 547 Status = AsciiStrCpyS ((CHAR8 *) Cur, BufferLength, (CHAR8 *) Mode); 548 ASSERT_EFI_ERROR (Status); 549 BufferLength -= (UINT32) (ModeLength + 1); 550 Cur += ModeLength + 1; 519 551 520 552 // … … 522 554 // 523 555 for (Index = 0; Index < Token->OptionCount; ++Index) { 524 Cur = (UINT8 *) AsciiStrCpy ((CHAR8 *) Cur, (CHAR8 *) Options[Index].OptionStr); 525 Cur += AsciiStrLen ((CHAR8 *) Options[Index].OptionStr) + 1; 526 Cur = (UINT8 *) AsciiStrCpy ((CHAR8 *) Cur, (CHAR8 *) Options[Index].ValueStr); 527 Cur += AsciiStrLen ((CHAR8 *) (CHAR8 *) Options[Index].ValueStr) + 1; 556 OptionStrLength = AsciiStrLen ((CHAR8 *) Options[Index].OptionStr); 557 ValueStrLength = AsciiStrLen ((CHAR8 *) Options[Index].ValueStr); 558 559 Status = AsciiStrCpyS ((CHAR8 *) Cur, BufferLength, (CHAR8 *) Options[Index].OptionStr); 560 ASSERT_EFI_ERROR (Status); 561 BufferLength -= (UINT32) (OptionStrLength + 1); 562 Cur += OptionStrLength + 1; 563 564 Status = AsciiStrCpyS ((CHAR8 *) Cur, BufferLength, (CHAR8 *) Options[Index].ValueStr); 565 ASSERT_EFI_ERROR (Status); 566 BufferLength -= (UINT32) (ValueStrLength + 1); 567 Cur += ValueStrLength + 1; 568 528 569 } 529 570 … … 585 626 TftpError->Error.ErrorCode = HTONS (ErrCode); 586 627 587 AsciiStrCpy ((CHAR8 *) TftpError->Error.ErrorMessage, (CHAR8 *) ErrInfo);628 AsciiStrCpyS ((CHAR8 *) TftpError->Error.ErrorMessage, AsciiStrLen ((CHAR8 *) ErrInfo) + 1 , (CHAR8 *) ErrInfo); 588 629 589 630 //
Note:
See TracChangeset
for help on using the changeset viewer.