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

@@ -191,12 +191,12 @@ onig_error_code_to_format(int code)
static void sprint_byte(char* s, unsigned int v)
{
sprintf(s, "%02x", (v & 0377));
sprintf_s(s, sizeof("00"), "%02x", (v & 0377));
}
static void sprint_byte_with_x(char* s, unsigned int v)
{
sprintf(s, "\\x%02x", (v & 0377));
sprintf_s(s, sizeof("\\x00"), "\\x%02x", (v & 0377));
}
static int to_ascii(OnigEncoding enc, UChar *s, UChar *end,