diff options
author | Dmitry Mikhirev | 2014-11-27 14:08:53 +0300 |
---|---|---|
committer | Dmitry Mikhirev | 2014-11-27 14:08:53 +0300 |
commit | 5fa944688dde4367658082bb01935a36113f7a2d (patch) | |
tree | 076a82567d099cf305550b348575309908891dcb | |
parent | 143c416740de7df722aa7f05aa7374b0673352d7 (diff) | |
download | make_pcre-5fa944688dde4367658082bb01935a36113f7a2d.tar.gz make_pcre-5fa944688dde4367658082bb01935a36113f7a2d.tar.bz2 make_pcre-5fa944688dde4367658082bb01935a36113f7a2d.tar.xz make_pcre-5fa944688dde4367658082bb01935a36113f7a2d.zip |
safer message composing
-rw-r--r-- | pcre.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -28,7 +28,7 @@ int plugin_is_GPL_compatible; const int MAX_CAP = 256; /* maximum number of substrings to capture */ const int MAX_CAP_LEN = 3; /* number of decimal digits in MAX_CAP */ -const int MAX_MSG_LEN = 1023; /* max length of error/warning/info message */ +const int MAX_MSG_LEN = 1024; /* max length of error/warning/info message */ /* esc_str() - escape string before assigning it to make variable */ char *esc_str(const char *str) @@ -63,8 +63,8 @@ int mk_error(const char *fmt, ...) va_start(args, fmt); - msg = gmk_alloc(MAX_MSG_LEN+1); - vsprintf(msg, fmt, args); + msg = gmk_alloc(MAX_MSG_LEN); + vsnprintf(msg, MAX_MSG_LEN, fmt, args); emsg = esc_str(msg); gmk_free(msg); mk = gmk_alloc(strlen(emsg) + 10); @@ -82,8 +82,8 @@ int mk_warning(const char *fmt, ...) va_start(args, fmt); - msg = gmk_alloc(MAX_MSG_LEN+1); - vsprintf(msg, fmt, args); + msg = gmk_alloc(MAX_MSG_LEN); + vsnprintf(msg, MAX_MSG_LEN, fmt, args); emsg = esc_str(msg); gmk_free(msg); mk = gmk_alloc(strlen(emsg) + 12); @@ -101,8 +101,8 @@ int mk_info(const char *fmt, ...) va_start(args, fmt); - msg = gmk_alloc(MAX_MSG_LEN+1); - vsprintf(msg, fmt, args); + msg = gmk_alloc(MAX_MSG_LEN); + vsnprintf(msg, MAX_MSG_LEN, fmt, args); emsg = esc_str(msg); gmk_free(msg); mk = gmk_alloc(strlen(emsg) + 9); |