static void sprint_byte(char* s, unsigned int v)
{
- sprintf(s, "%02x", (v & 0377));
+ xsnprintf(s, 3, "%02x", (v & 0377));
}
static void sprint_byte_with_x(char* s, unsigned int v)
{
- sprintf(s, "\\x%02x", (v & 0377));
+ xsnprintf(s, 5, "\\x%02x", (v & 0377));
}
static int to_ascii(OnigEncoding enc, UChar *s, UChar *end,
#if defined(_WIN32) && !defined(__GNUC__)
#define xalloca _alloca
#define xvsnprintf _vsnprintf
+#define xsnprintf sprintf_s
#else
#define xalloca alloca
#define xvsnprintf vsnprintf
+#define xsnprintf snprintf
#endif
# define ARG_UNUSED
#endif
+#if defined(_WIN32) && !defined(__GNUC__)
+#define xsnprintf sprintf_s
+#else
+#define xsnprintf snprintf
+#endif
+
static char* ESTRING[] = {
NULL,
"failed to match", /* REG_NOMATCH */
s = "";
}
else {
- sprintf(tbuf, "undefined error code (%d)", posix_ecode);
+ xsnprintf(tbuf, sizeof(tbuf), "undefined error code (%d)", posix_ecode);
s = tbuf;
}
*/
#include "config.h"
-#include "oniguruma.h"
+#include "regint.h"
#include <stdio.h>
extern const char*
{
static char s[12];
- sprintf(s, "%d.%d.%d",
- ONIGURUMA_VERSION_MAJOR,
- ONIGURUMA_VERSION_MINOR,
- ONIGURUMA_VERSION_TEENY);
+ xsnprintf(s, sizeof(s), "%d.%d.%d",
+ ONIGURUMA_VERSION_MAJOR,
+ ONIGURUMA_VERSION_MINOR,
+ ONIGURUMA_VERSION_TEENY);
return s;
}
{
static char s[58];
- sprintf(s, "Oniguruma %d.%d.%d : Copyright (C) 2002-2008 K.Kosako",
- ONIGURUMA_VERSION_MAJOR,
- ONIGURUMA_VERSION_MINOR,
- ONIGURUMA_VERSION_TEENY);
+ xsnprintf(s, sizeof(s),
+ "Oniguruma %d.%d.%d : Copyright (C) 2002-2016 K.Kosako",
+ ONIGURUMA_VERSION_MAJOR,
+ ONIGURUMA_VERSION_MINOR,
+ ONIGURUMA_VERSION_TEENY);
return s;
}