]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/UefiPxeBcDxe/PxeBcMtftp.c
fix the problem that data type conversion may loss data.
[mirror_edk2.git] / NetworkPkg / UefiPxeBcDxe / PxeBcMtftp.c
index 8adba6620f136df76ff129517073528b94cb9885..09196c7ac6579e473067287412c12f935ffc63fd 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Functions implementation related with Mtftp for UefiPxeBc Driver.\r
 \r
-  Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
@@ -69,6 +69,7 @@ PxeBcMtftp6CheckPacket (
       (CHAR8 *) Packet->Error.ErrorMessage,\r
       PXE_MTFTP_ERROR_STRING_LENGTH\r
       );\r
+    Private->Mode.TftpError.ErrorString[PXE_MTFTP_ERROR_STRING_LENGTH - 1] = '\0';\r
   }\r
 \r
   if (Callback != NULL) {\r
@@ -162,7 +163,7 @@ PxeBcMtftp6GetFileSize (
 \r
   Status = Mtftp6->GetInfo (\r
                      Mtftp6,\r
-                     FALSE,\r
+                     NULL,\r
                      Filename,\r
                      NULL,\r
                      (UINT8) OptCnt,\r
@@ -182,6 +183,7 @@ PxeBcMtftp6GetFileSize (
         (CHAR8 *) Packet->Error.ErrorMessage,\r
         PXE_MTFTP_ERROR_STRING_LENGTH\r
         );\r
+      Private->Mode.TftpError.ErrorString[PXE_MTFTP_ERROR_STRING_LENGTH - 1] = '\0';\r
     }\r
     goto ON_ERROR;\r
   }\r
@@ -511,6 +513,7 @@ PxeBcMtftp4CheckPacket (
       (CHAR8 *) Packet->Error.ErrorMessage,\r
       PXE_MTFTP_ERROR_STRING_LENGTH\r
       );\r
+    Private->Mode.TftpError.ErrorString[PXE_MTFTP_ERROR_STRING_LENGTH - 1] = '\0';\r
   }\r
 \r
   if (Callback != NULL) {\r
@@ -604,7 +607,7 @@ PxeBcMtftp4GetFileSize (
 \r
   Status = Mtftp4->GetInfo (\r
                      Mtftp4,\r
-                     FALSE,\r
+                     NULL,\r
                      Filename,\r
                      NULL,\r
                      (UINT8) OptCnt,\r
@@ -624,6 +627,7 @@ PxeBcMtftp4GetFileSize (
         (CHAR8 *) Packet->Error.ErrorMessage,\r
         PXE_MTFTP_ERROR_STRING_LENGTH\r
         );\r
+      Private->Mode.TftpError.ErrorString[PXE_MTFTP_ERROR_STRING_LENGTH - 1] = '\0';\r
     }\r
     goto ON_ERROR;\r
   }\r