diff options
-rw-r--r-- | plugins/MirOTR/src/dbfilter.cpp | 8 |
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) { |