summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2015-05-16 18:19:08 +0000
committerKirill Volinsky <mataes2007@gmail.com>2015-05-16 18:19:08 +0000
commit1d2bbcacaa044a84d7e32f11198a15e9d2f85b00 (patch)
treede12df93a067d520acf7546fe759799b10c3477f /plugins
parente95b95c3931710251ebfd2a8fca53da3764f3094 (diff)
fix for strncat use
git-svn-id: http://svn.miranda-ng.org/main/trunk@13636 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/MirOTR/src/dbfilter.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/plugins/MirOTR/src/dbfilter.cpp b/plugins/MirOTR/src/dbfilter.cpp
index 0ae91eeb37..efc6b04ef0 100644
--- a/plugins/MirOTR/src/dbfilter.cpp
+++ b/plugins/MirOTR/src/dbfilter.cpp
@@ -91,7 +91,7 @@ int OnDatabaseEventPreAdd(WPARAM hContact, LPARAM lParam)
newmsg = (char*)mir_alloc(alloclen);
memset(newmsg, 0, alloclen+datalen);
strncpy(newmsg, options.prefix, prefixlen);
- strncat(newmsg, msg, msglen);
+ strncat(newmsg, msg, alloclen - mir_strlen(newmsg));
// append additional data
if (datalen) {
memcpy(newmsg+alloclen, msg+len2, datalen);
@@ -130,10 +130,10 @@ int OnDatabaseEventPreAdd(WPARAM hContact, LPARAM lParam)
newmsg = (char*)mir_alloc(alloclen+datalen);
memset(newmsg, 0, alloclen+datalen);
strncpy(newmsg, prefix, prefixlen);
- strncat(newmsg, msg, msglen);
+ strncat(newmsg, msg, alloclen + datalen - mir_strlen(newmsg));
wchar_t *p = (wchar_t*) newmsg + (msglen + prefixlen + 1);
wcsncpy(p, prefixw, prefixlenw);
- wcsncat(p, msgw, msglenw);
+ wcsncat(p, msgw, msglenw - mir_wstrlen(p));
mir_free(prefix);
mir_free(prefixw);
// append additional data
@@ -158,7 +158,7 @@ int OnDatabaseEventPreAdd(WPARAM hContact, LPARAM lParam)
newmsg = (char*)mir_alloc(alloclen+datalen);
memset(newmsg, 0, alloclen+datalen);
strncpy(newmsg, prefix, prefixlen);
- strncat(newmsg, msg, msglen);
+ strncat(newmsg, msg, msglen - mir_strlen(newmsg));
mir_free(prefix);
// append additional data
if (datalen) {