]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/IScsiDxe/IScsiCHAP.c
Update code to avoid potential access violation.
[mirror_edk2.git] / NetworkPkg / IScsiDxe / IScsiCHAP.c
index 4cfbba7b5cdba32d9774876413f6a0e9e62aff8f..fd31d4fb0c4799883ecf366a2f1359150bdbde26 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   This file is for Challenge-Handshake Authentication Protocol (CHAP) Configuration.\r
 \r
-Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -374,6 +374,9 @@ IScsiCHAPToSendReq (
   Session     = Conn->Session;\r
   AuthData    = &Session->AuthData.CHAP;\r
   LoginReq    = (ISCSI_LOGIN_REQUEST *) NetbufGetByte (Pdu, 0, 0);\r
+  if (LoginReq == NULL) {\r
+    return EFI_PROTOCOL_ERROR;\r
+  }\r
   Status      = EFI_SUCCESS;\r
 \r
   RspLen      = 2 * ISCSI_CHAP_RSP_LEN + 3;\r