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

Michael D Kinney posted 1 patch 2 years, 8 months ago
Failed in applying to current master (apply log)
StdLib/PosixLib/GetPass/GetPass.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[edk2-devel] [edk2-libc Patch] StdLib/PosixLib/GetPass: Update to use safe string functions
Posted by Michael D Kinney 2 years, 8 months ago
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3361

Cc: Rebecca Cran <rebecca@nuviainc.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@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/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [edk2-libc Patch] StdLib/PosixLib/GetPass: Update to use safe string functions
Posted by Rebecca Cran 2 years, 8 months ago
Reviewed-by: Rebecca Cran <rebecca@nuviainc.com>


-- 
Rebecca Cran


On 8/17/21 9:32 AM, Michael D Kinney wrote:
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3361
>
> Cc: Rebecca Cran <rebecca@nuviainc.com>
> Signed-off-by: Michael D Kinney <michael.d.kinney@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);
>   


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#79539): https://edk2.groups.io/g/devel/message/79539
Mute This Topic: https://groups.io/mt/84950432/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-