From: kosako Date: Mon, 18 Apr 2016 05:04:36 +0000 (+0900) Subject: add xstncat() for strcat_s() X-Git-Tag: v6.0.0^2~45 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=48ba14975c70f4313db52fb170c232d38623a6ad;p=onig add xstncat() for strcat_s() --- diff --git a/src/regerror.c b/src/regerror.c index ab24b4c..ca17e1d 100644 --- a/src/regerror.c +++ b/src/regerror.c @@ -339,7 +339,7 @@ onig_snprintf_with_pattern(buf, bufsize, enc, pat, pat_end, fmt, va_alist) need = (pat_end - pat) * 4 + 4; if (n + need < bufsize) { - strcat((char* )buf, ": /"); + xstrncat((char* )buf, ": /", bufsize); s = buf + onigenc_str_bytelen_null(ONIG_ENCODING_ASCII, buf); p = pat; diff --git a/src/regint.h b/src/regint.h index cc5c5eb..daecf70 100644 --- a/src/regint.h +++ b/src/regint.h @@ -130,10 +130,12 @@ #define xalloca _alloca #define xvsnprintf(buf,size,fmt,args) _vsnprintf_s(buf,size,_TRUNCATE,fmt,args) #define xsnprintf sprintf_s +#define xstrncat(dest,src,n) strcat_s(dest,n,src) #else #define xalloca alloca #define xvsnprintf vsnprintf #define xsnprintf snprintf +#define xstrncat(dest,src,n) strncat(dest,src,n) #endif