mirror of https://github.com/acidanthera/audk.git
NetworkPkg: update code for NULL pointer check.
This patch updates the HTTP driver to initialize the local variable for NULL and check the NULL pointer before dereference it. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com> Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
This commit is contained in:
parent
26bd6437ca
commit
5646819ffb
|
@ -253,6 +253,7 @@ EfiHttpRequest (
|
||||||
// Initializations
|
// Initializations
|
||||||
//
|
//
|
||||||
Url = NULL;
|
Url = NULL;
|
||||||
|
UrlParser = NULL;
|
||||||
HostName = NULL;
|
HostName = NULL;
|
||||||
RequestMsg = NULL;
|
RequestMsg = NULL;
|
||||||
HostNameStr = NULL;
|
HostNameStr = NULL;
|
||||||
|
@ -1063,7 +1064,7 @@ HttpResponseWorker (
|
||||||
if (SizeofHeaders != 0) {
|
if (SizeofHeaders != 0) {
|
||||||
HeaderTmp = AllocateZeroPool (SizeofHeaders);
|
HeaderTmp = AllocateZeroPool (SizeofHeaders);
|
||||||
if (HeaderTmp == NULL) {
|
if (HeaderTmp == NULL) {
|
||||||
goto Error;
|
goto Error2;
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyMem (HeaderTmp, Tmp, SizeofHeaders);
|
CopyMem (HeaderTmp, Tmp, SizeofHeaders);
|
||||||
|
@ -1075,7 +1076,7 @@ HttpResponseWorker (
|
||||||
//
|
//
|
||||||
if (mHttpUtilities == NULL) {
|
if (mHttpUtilities == NULL) {
|
||||||
Status = EFI_NOT_READY;
|
Status = EFI_NOT_READY;
|
||||||
goto Error;
|
goto Error2;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -1089,7 +1090,7 @@ HttpResponseWorker (
|
||||||
&HttpMsg->HeaderCount
|
&HttpMsg->HeaderCount
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
goto Error;
|
goto Error2;
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (HttpHeaders);
|
FreePool (HttpHeaders);
|
||||||
|
@ -1214,7 +1215,7 @@ HttpResponseWorker (
|
||||||
&HttpInstance->TimeoutEvent
|
&HttpInstance->TimeoutEvent
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
goto Error;
|
goto Error2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1223,7 +1224,7 @@ HttpResponseWorker (
|
||||||
//
|
//
|
||||||
Status = gBS->SetTimer (HttpInstance->TimeoutEvent, TimerRelative, HTTP_RESPONSE_TIMEOUT * TICKS_PER_SECOND);
|
Status = gBS->SetTimer (HttpInstance->TimeoutEvent, TimerRelative, HTTP_RESPONSE_TIMEOUT * TICKS_PER_SECOND);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
goto Error;
|
goto Error2;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -1234,7 +1235,7 @@ HttpResponseWorker (
|
||||||
gBS->SetTimer (HttpInstance->TimeoutEvent, TimerCancel, 0);
|
gBS->SetTimer (HttpInstance->TimeoutEvent, TimerCancel, 0);
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
goto Error;
|
goto Error2;
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (Wrap);
|
FreePool (Wrap);
|
||||||
|
@ -1258,7 +1259,9 @@ Exit:
|
||||||
return Status;
|
return Status;
|
||||||
|
|
||||||
Error2:
|
Error2:
|
||||||
NetMapInsertHead (&HttpInstance->TxTokens, ValueInItem->HttpToken, ValueInItem);
|
if (ValueInItem != NULL) {
|
||||||
|
NetMapInsertHead (&HttpInstance->TxTokens, ValueInItem->HttpToken, ValueInItem);
|
||||||
|
}
|
||||||
|
|
||||||
Error:
|
Error:
|
||||||
HttpTcpTokenCleanup (Wrap);
|
HttpTcpTokenCleanup (Wrap);
|
||||||
|
|
Loading…
Reference in New Issue