NetworkPkg/DxeNetLib: Fix CodeQl Error

Fix possible NULL pointer dereference in NetBuffer.c This was flagged by
CodeQl as an error.

Github Issue #11190

Signed-off-by: Brit Chesley <brit.chesley@amd.com>
This commit is contained in:
Brit Chesley
2025-06-12 15:05:49 -05:00
committed by mergify[bot]
parent 617e061830
commit e076d2ab8c
2 changed files with 8 additions and 3 deletions

View File

@ -2081,7 +2081,8 @@ NetbufQueAppend (
@param[out] Dest The destination of the data to copy to.
@return The length of the actual copied data, or 0 if the offset
specified exceeds the total size of net buffer queue.
specified exceeds the total size of net buffer queue, or
a NetBuf pointer is NULL.
**/
UINT32

View File

@ -1430,7 +1430,8 @@ NetbufQueRemove (
@param[out] Dest The destination of the data to copy to.
@return The length of the actual copied data, or 0 if the offset
specified exceeds the total size of net buffer queue.
specified exceeds the total size of net buffer queue, or
a NetBuf pointer is NULL.
**/
UINT32
@ -1476,7 +1477,10 @@ NetbufQueCopy (
Cur += Nbuf->TotalSize;
}
ASSERT (Nbuf != NULL);
if (Nbuf == NULL) {
ASSERT (FALSE);
return 0;
}
//
// Copy the data in the first buffer.