[edk2-devel] [edk2-libc Patch] StdLib/PosixLib/GetPass: Update to use safe string functions

Michael D Kinney michael.d.kinney at intel.com
Tue Aug 17 15:32:46 UTC 2021


REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3361

Cc: Rebecca Cran <rebecca at nuviainc.com>
Signed-off-by: Michael D Kinney <michael.d.kinney at intel.com>
---
 StdLib/PosixLib/GetPass/GetPass.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/StdLib/PosixLib/GetPass/GetPass.c b/StdLib/PosixLib/GetPass/GetPass.c
index 46511e3..8657827 100644
--- a/StdLib/PosixLib/GetPass/GetPass.c
+++ b/StdLib/PosixLib/GetPass/GetPass.c
@@ -15,6 +15,7 @@
 #include <Library/MemoryAllocationLib.h>
 #include <Library/UefiLib.h>
 #include <Library/PcdLib.h>
+#include <limits.h>
 
 static CHAR8   *ReturnStringAscii = NULL;
 
@@ -37,7 +38,7 @@ char *getpass(const char *Prompt)
     return (NULL);
   }
 
-  UnicodeStrToAsciiStr(ReturnString, ReturnStringAscii);
+  UnicodeStrToAsciiStrS(ReturnString, ReturnStringAscii, UNICODE_STRING_MAX);
 
   FreePool(ReturnString);
 
-- 
2.32.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#79437): https://edk2.groups.io/g/devel/message/79437
Mute This Topic: https://groups.io/mt/84950432/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list