summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-04-16 15:28:37 +0300
committerAndrei Karas <akaras@inbox.ru>2011-04-16 15:28:37 +0300
commitca422c9bc6d9b352ade3e418958241ad79939a02 (patch)
tree3d29a78458df93e3de842509ea678c12e1f03f11 /src
parentb026b5440f8077562d8059db9277504d17a71de9 (diff)
downloadmv-ca422c9bc6d9b352ade3e418958241ad79939a02.tar.gz
mv-ca422c9bc6d9b352ade3e418958241ad79939a02.tar.bz2
mv-ca422c9bc6d9b352ade3e418958241ad79939a02.tar.xz
mv-ca422c9bc6d9b352ade3e418958241ad79939a02.zip
Change vsprintf to vsnprintf.
Like was in mana commit bb795d87f9d0eebb6cc04b5c6806252fbb957f5d
Diffstat (limited to 'src')
-rw-r--r--src/log.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/log.cpp b/src/log.cpp
index 982f2eed7..abd6beb76 100644
--- a/src/log.cpp
+++ b/src/log.cpp
@@ -144,15 +144,16 @@ void Logger::log(const char *log_text, ...)
{
unsigned size = 1024;
char* buf = 0;
- if (strlen(log_text) * 3 > size)
+ if (strlen(log_text) * 3> size)
size = static_cast<unsigned>(strlen(log_text) * 3);
- buf = new char[size];
+ buf = new char[size + 1];
va_list ap;
// Use a temporary buffer to fill in the variables
va_start(ap, log_text);
- vsprintf(buf, log_text, ap);
+ vsnprintf(buf, size, log_text, ap);
+ buf[size] = 0;
va_end(ap);
// Get the current system time