MdeModulePkg: For RegularExpressionDxe use 'sprintf_s' to replace 'sprintf'.

Function 'sprintf' has potential buffer overflow risk. This patch use 'sprintf_s' to improve the code.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Yao Jiewen <Jiewen.Yao@intel.com>
Reviewed-by: Cinnamon Shia <cinnamon.shia@hpe.com>
Reviewed-by: Samer El-Haj-Mahmoud <elhaj@hpe.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19582 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Qiu Shumin
2016-01-04 05:14:53 +00:00
committed by shenshushi
parent c9f46d31f4
commit 61e078ddcb
5 changed files with 12 additions and 8 deletions

View File

@@ -14,13 +14,13 @@
**/
#include "OnigurumaUefiPort.h"
int sprintf(char *str, char const *fmt, ...)
int sprintf_s(char *str, size_t sizeOfBuffer, char const *fmt, ...)
{
VA_LIST Marker;
int NumberOfPrinted;
VA_START (Marker, fmt);
NumberOfPrinted = (int)AsciiVSPrint (str, 1000000, fmt, Marker);
NumberOfPrinted = (int)AsciiVSPrint (str, sizeOfBuffer, fmt, Marker);
VA_END (Marker);
return NumberOfPrinted;