diff options
author | Star Zeng <star.zeng@intel.com> | 2016-06-15 13:38:03 +0800 |
---|---|---|
committer | Star Zeng <star.zeng@intel.com> | 2016-06-21 12:46:24 +0800 |
commit | b9679cd7458110573dd4614148433312b61a1e26 (patch) | |
tree | 88423b27ce0fed9ba6e79168caeff6ad8f2ddbcd /NetworkPkg/HttpDxe | |
parent | b68ccac17c7e6340ab7b3654ea51c86ad6b4201d (diff) | |
download | edk2-platforms-b9679cd7458110573dd4614148433312b61a1e26.tar.xz |
NetworkPkg: Replace UnicodeStrToAsciiStr/AsciiStrToUnicodeStr
It is the follow up of 3ab41b7a325ca11a12b42f5ad1661c4b6791cb49
to replace UnicodeStrToAsciiStr/AsciiStrToUnicodeStr with
UnicodeStrToAsciiStrS/AsciiStrToUnicodeStrS.
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
Diffstat (limited to 'NetworkPkg/HttpDxe')
-rw-r--r-- | NetworkPkg/HttpDxe/HttpImpl.c | 8 | ||||
-rw-r--r-- | NetworkPkg/HttpDxe/HttpProto.c | 8 |
2 files changed, 10 insertions, 6 deletions
diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c index ad194dbe0e..6fcb0b7c6e 100644 --- a/NetworkPkg/HttpDxe/HttpImpl.c +++ b/NetworkPkg/HttpDxe/HttpImpl.c @@ -236,6 +236,7 @@ EfiHttpRequest ( VOID *UrlParser;
EFI_STATUS Status;
CHAR8 *HostName;
+ UINTN HostNameSize;
UINT16 RemotePort;
HTTP_PROTOCOL *HttpInstance;
BOOLEAN Configure;
@@ -343,7 +344,7 @@ EfiHttpRequest ( }
- UnicodeStrToAsciiStr (Request->Url, Url);
+ UnicodeStrToAsciiStrS (Request->Url, Url, UrlLen);
UrlParser = NULL;
Status = HttpParseUrl (Url, (UINT32) AsciiStrLen (Url), FALSE, &UrlParser);
if (EFI_ERROR (Status)) {
@@ -443,13 +444,14 @@ EfiHttpRequest ( }
if (EFI_ERROR (Status)) {
- HostNameStr = AllocateZeroPool ((AsciiStrLen (HostName) + 1) * sizeof (CHAR16));
+ HostNameSize = AsciiStrSize (HostName);
+ HostNameStr = AllocateZeroPool (HostNameSize * sizeof (CHAR16));
if (HostNameStr == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto Error1;
}
- AsciiStrToUnicodeStr (HostName, HostNameStr);
+ AsciiStrToUnicodeStrS (HostName, HostNameStr, HostNameSize);
if (!HttpInstance->LocalAddressIsIPv6) {
Status = HttpDns4 (HttpInstance, HostNameStr, &HttpInstance->RemoteAddr);
} else {
diff --git a/NetworkPkg/HttpDxe/HttpProto.c b/NetworkPkg/HttpDxe/HttpProto.c index 486b20304f..6373f07215 100644 --- a/NetworkPkg/HttpDxe/HttpProto.c +++ b/NetworkPkg/HttpDxe/HttpProto.c @@ -1,7 +1,7 @@ /** @file
Miscellaneous routines for HttpDxe driver.
-Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -1489,6 +1489,7 @@ HttpTcpTransmit ( EFI_STATUS Status;
CHAR8 *RequestMsg;
CHAR8 *Url;
+ UINTN UrlSize;
UINTN RequestMsgSize;
ValueInItem = (HTTP_TOKEN_WRAP *) Item->Value;
@@ -1499,12 +1500,13 @@ HttpTcpTransmit ( //
// Parse the URI of the remote host.
//
- Url = AllocatePool (StrLen (ValueInItem->HttpToken->Message->Data.Request->Url) + 1);
+ UrlSize = StrLen (ValueInItem->HttpToken->Message->Data.Request->Url) + 1;
+ Url = AllocatePool (UrlSize);
if (Url == NULL) {
return EFI_OUT_OF_RESOURCES;
}
- UnicodeStrToAsciiStr (ValueInItem->HttpToken->Message->Data.Request->Url, Url);
+ UnicodeStrToAsciiStrS (ValueInItem->HttpToken->Message->Data.Request->Url, Url, UrlSize);
//
// Create request message.
|