Add more check to make code more safely.

Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ouyang Qian  <ouyang.qian@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13903 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
ydong10
2012-11-01 02:10:31 +00:00
parent 0d5df2aba7
commit a56b6e03e2
6 changed files with 11 additions and 1 deletions

View File

@ -465,6 +465,7 @@ Mtftp4SendPacket (
// to the connected port
//
Value = *((UINT16 *) NetbufGetByte (Packet, 0, NULL));
ASSERT (Value != NULL);
OpCode = NTOHS (Value);
if ((OpCode == EFI_MTFTP4_OPCODE_RRQ) ||
@ -522,6 +523,7 @@ Mtftp4Retransmit (
// Set the requests to the listening port, other packets to the connected port
//
Value = *(UINT16 *) NetbufGetByte (Instance->LastPacket, 0, NULL);
ASSERT (Value != NULL);
OpCode = NTOHS (Value);
if ((OpCode == EFI_MTFTP4_OPCODE_RRQ) || (OpCode == EFI_MTFTP4_OPCODE_DIR) ||