]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regerror.c
MdeModulePkg/UDF: Fix creation of UDF logical partition
[mirror_edk2.git] / MdeModulePkg / Universal / RegularExpressionDxe / Oniguruma / regerror.c
index 7bbcd02bcd44c73e45f8e961d3124535ea809f3d..1544e23f103711a4d309fdce39a8463ba7bb8ca6 100644 (file)
@@ -5,7 +5,7 @@
  * Copyright (c) 2002-2007  K.Kosako  <sndgk393 AT ybb DOT ne DOT jp>\r
  * All rights reserved.\r
  *\r
- * Copyright (c) 2015, Hewlett Packard Enterprise Development, L.P.<BR>\r
+ * (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>\r
  *\r
  * Redistribution and use in source and binary forms, with or without\r
  * modification, are permitted provided that the following conditions\r
@@ -191,12 +191,12 @@ onig_error_code_to_format(int code)
 \r
 static void sprint_byte(char* s, unsigned int v)\r
 {\r
-  sprintf(s, "%02x", (v & 0377));\r
+  sprintf_s(s, sizeof("00"), "%02x", (v & 0377));\r
 }\r
 \r
 static void sprint_byte_with_x(char* s, unsigned int v)\r
 {\r
-  sprintf(s, "\\x%02x", (v & 0377));\r
+  sprintf_s(s, sizeof("\\x00"), "\\x%02x", (v & 0377));\r
 }\r
 \r
 static int to_ascii(OnigEncoding enc, UChar *s, UChar *end,\r
@@ -252,6 +252,7 @@ static int to_ascii(OnigEncoding enc, UChar *s, UChar *end,
 #define MAX_ERROR_PAR_LEN   30\r
 \r
 extern int\r
+EFIAPI\r
 #ifdef HAVE_STDARG_PROTOTYPES\r
 onig_error_code_to_str(UChar* s, int code, ...)\r
 #else\r
@@ -308,6 +309,10 @@ onig_error_code_to_str(s, code, va_alist)
 \r
   default:\r
     q = onig_error_code_to_format(code);\r
+    if (q == NULL) {\r
+      len = 0;\r
+      break;\r
+    }\r
     len = onigenc_str_bytelen_null(ONIG_ENCODING_ASCII, q);\r
     xmemcpy(s, q, len);\r
     s[len] = '\0';\r
@@ -320,6 +325,7 @@ onig_error_code_to_str(s, code, va_alist)
 \r
 \r
 void\r
+EFIAPI\r
 #ifdef HAVE_STDARG_PROTOTYPES\r
 onig_snprintf_with_pattern(UChar buf[], int bufsize, OnigEncoding enc,\r
                            UChar* pat, UChar* pat_end, const UChar *fmt, ...)\r