mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-26 07:04:28 +02:00
NetworkPkg/HttpDxe: Track HttpInstance URL buffer length.
In EfiHttpRequest(), length of target URLs was always compared to fixed-size value, even after allocating a larger URL buffer. Added UrlLen to HTTP_PROTOCOL to store the size and reallocate if the size changes. Signed-off-by: Saloni Kasbekar <saloni.kasbekar@intel.com>
This commit is contained in:
parent
071d2cfab8
commit
5c86b0b57c
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Implementation of EFI_HTTP_PROTOCOL protocol interfaces.
|
Implementation of EFI_HTTP_PROTOCOL protocol interfaces.
|
||||||
|
|
||||||
Copyright (c) 2015 - 2021, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
|
||||||
(C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>
|
(C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>
|
||||||
Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.<BR>
|
Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.<BR>
|
||||||
|
|
||||||
@ -341,14 +341,18 @@ EfiHttpRequest (
|
|||||||
//
|
//
|
||||||
Url = HttpInstance->Url;
|
Url = HttpInstance->Url;
|
||||||
UrlLen = StrLen (Request->Url) + 1;
|
UrlLen = StrLen (Request->Url) + 1;
|
||||||
if (UrlLen > HTTP_URL_BUFFER_LEN) {
|
if (UrlLen > HttpInstance->UrlLen) {
|
||||||
Url = AllocateZeroPool (UrlLen);
|
Url = AllocateZeroPool (UrlLen);
|
||||||
if (Url == NULL) {
|
if (Url == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (HttpInstance->Url);
|
if (HttpInstance->Url != NULL) {
|
||||||
HttpInstance->Url = Url;
|
FreePool (HttpInstance->Url);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpInstance->Url = Url;
|
||||||
|
HttpInstance->UrlLen = UrlLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
UnicodeStrToAsciiStrS (Request->Url, Url, UrlLen);
|
UnicodeStrToAsciiStrS (Request->Url, Url, UrlLen);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Miscellaneous routines for HttpDxe driver.
|
Miscellaneous routines for HttpDxe driver.
|
||||||
|
|
||||||
Copyright (c) 2015 - 2021, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
|
||||||
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
|
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
|
||||||
Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.<BR>
|
Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.<BR>
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
@ -738,6 +738,7 @@ HttpInitProtocol (
|
|||||||
goto ON_ERROR;
|
goto ON_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpInstance->UrlLen = HTTP_URL_BUFFER_LEN;
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
|
||||||
ON_ERROR:
|
ON_ERROR:
|
||||||
@ -847,7 +848,8 @@ HttpCleanProtocol (
|
|||||||
|
|
||||||
if (HttpInstance->Url != NULL) {
|
if (HttpInstance->Url != NULL) {
|
||||||
FreePool (HttpInstance->Url);
|
FreePool (HttpInstance->Url);
|
||||||
HttpInstance->Url = NULL;
|
HttpInstance->Url = NULL;
|
||||||
|
HttpInstance->UrlLen = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
NetMapClean (&HttpInstance->TxTokens);
|
NetMapClean (&HttpInstance->TxTokens);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
The header files of miscellaneous routines for HttpDxe driver.
|
The header files of miscellaneous routines for HttpDxe driver.
|
||||||
|
|
||||||
Copyright (c) 2015 - 2021, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
|
||||||
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
|
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
|
||||||
Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.<BR>
|
Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.<BR>
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
@ -165,6 +165,7 @@ typedef struct _HTTP_PROTOCOL {
|
|||||||
NET_MAP RxTokens;
|
NET_MAP RxTokens;
|
||||||
|
|
||||||
CHAR8 *Url;
|
CHAR8 *Url;
|
||||||
|
UINTN UrlLen;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Https Support
|
// Https Support
|
||||||
|
Loading…
x
Reference in New Issue
Block a user