diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2015-05-16 17:58:06 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2015-05-16 17:58:06 +0000 |
commit | b6aaf5fb96db808ae73415c54588e987f66bc242 (patch) | |
tree | 44a1a1913b933653062c013a98c3fb94203a4cc7 /plugins/CmdLine | |
parent | 8afb55f81f38daef246b9cdb82b680ef8538881d (diff) |
fix for strncat use
git-svn-id: http://svn.miranda-ng.org/main/trunk@13630 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/CmdLine')
-rw-r--r-- | plugins/CmdLine/MimCmd/src/commands.cpp | 8 | ||||
-rw-r--r-- | plugins/CmdLine/MimCmd/src/common.h | 2 | ||||
-rw-r--r-- | plugins/CmdLine/src/mimcmd_handlers.cpp | 32 |
3 files changed, 22 insertions, 20 deletions
diff --git a/plugins/CmdLine/MimCmd/src/commands.cpp b/plugins/CmdLine/MimCmd/src/commands.cpp index eba3893763..6dddcffc43 100644 --- a/plugins/CmdLine/MimCmd/src/commands.cpp +++ b/plugins/CmdLine/MimCmd/src/commands.cpp @@ -141,11 +141,11 @@ void HandleHelpCommand(PCommand helpCommand, char *argv[], int argc, PReply repl for (int i = 0; i < cKnownCommands - 1; i++)
{
- strncat(reply->message, knownCommands[i].command, size);
- strncat(reply->message, ", ", size);
+ strncat(reply->message, knownCommands[i].command, SIZEOF(reply->message) - mir_strlen(reply->message));
+ strncat(reply->message, ", ", SIZEOF(reply->message) - mir_strlen(reply->message));
}
- strncat(reply->message, knownCommands[cKnownCommands - 1].command, size);
- strncat(reply->message, ".", size);
+ strncat(reply->message, knownCommands[cKnownCommands - 1].command, SIZEOF(reply->message) - mir_strlen(reply->message));
+ strncat(reply->message, ".", SIZEOF(reply->message) - mir_strlen(reply->message));
}
}
diff --git a/plugins/CmdLine/MimCmd/src/common.h b/plugins/CmdLine/MimCmd/src/common.h index fddbf01649..2b6057ec9c 100644 --- a/plugins/CmdLine/MimCmd/src/common.h +++ b/plugins/CmdLine/MimCmd/src/common.h @@ -27,6 +27,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <newpluginapi.h>
#include <m_langpack.h>
+#include <m_system.h>
+#include <m_system_cpp.h>
#include "..\..\src\mimcmd_ipc.h"
#include "version.h"
diff --git a/plugins/CmdLine/src/mimcmd_handlers.cpp b/plugins/CmdLine/src/mimcmd_handlers.cpp index 97266a83b4..6894f4c602 100644 --- a/plugins/CmdLine/src/mimcmd_handlers.cpp +++ b/plugins/CmdLine/src/mimcmd_handlers.cpp @@ -253,14 +253,14 @@ void HandleStatusCommand(PCommand command, TArgument *argv, int argc, PReply rep INT_PTR status = CallProtoService(accounts[i]->szModuleName, PS_GETSTATUS, 0, 0);
PrettyStatusMode(status, pn, sizeof(pn));
- strncat(perAccountStatus, "\n", cPerAccountStatus);
+ strncat(perAccountStatus, "\n", cPerAccountStatus - mir_strlen(perAccountStatus));
char *account = mir_u2a((wchar_t *) accounts[i]->tszAccountName);
- strncat(perAccountStatus, account, cPerAccountStatus);
+ strncat(perAccountStatus, account, cPerAccountStatus - mir_strlen(perAccountStatus));
mir_free(account);
- strncat(perAccountStatus, ": ", cPerAccountStatus);
- strncat(perAccountStatus, pn, cPerAccountStatus);
+ strncat(perAccountStatus, ": ", cPerAccountStatus - mir_strlen(perAccountStatus));
+ strncat(perAccountStatus, pn, cPerAccountStatus - mir_strlen(perAccountStatus));
}
}
@@ -391,8 +391,8 @@ void HandleAwayMsgCommand(PCommand command, TArgument *argv, int argc, PReply re if (i != 0)
{
- strncat(reply->message, "\n", reply->cMessage);
- strncat(reply->message, buffer, reply->cMessage);
+ strncat(reply->message, "\n", reply->cMessage - mir_strlen(reply->message));
+ strncat(reply->message, buffer, reply->cMessage - mir_strlen(reply->message));
}
else{
STRNCPY(reply->message, buffer, reply->cMessage);
@@ -918,8 +918,8 @@ void HandleMessageCommand(PCommand command, TArgument *argv, int argc, PReply re STRNCPY(reply->message, buffer, reply->cMessage);
}
else {
- strncat(reply->message, "\n", reply->cMessage);
- strncat(reply->message, buffer, reply->cMessage);
+ strncat(reply->message, "\n", reply->cMessage - mir_strlen(reply->message));
+ strncat(reply->message, buffer, reply->cMessage - mir_strlen(reply->message));
}
}
}
@@ -1287,8 +1287,8 @@ void HandleProtocolProxyCommand(PCommand command, TArgument *argv, int argc, PRe if (reply->message[0] != 0)
{
- strncat(reply->message, "\n", reply->cMessage);
- strncat(reply->message, buffer, reply->cMessage);
+ strncat(reply->message, "\n", reply->cMessage - mir_strlen(reply->message));
+ strncat(reply->message, buffer, reply->cMessage - mir_strlen(reply->message));
reply->message[reply->cMessage - 1] = 0;
}
else{
@@ -1455,8 +1455,8 @@ void HandleContactsCommand(PCommand command, TArgument *argv, int argc, PReply r mir_snprintf(buffer, SIZEOF(buffer), "%s:[%s]:%s (%08d)", contact, id, protocol, hContact);
if (count)
{
- strncat(reply->message, "\n", reply->cMessage);
- strncat(reply->message, buffer, reply->cMessage);
+ strncat(reply->message, "\n", reply->cMessage - mir_strlen(reply->message));
+ strncat(reply->message, buffer, reply->cMessage - mir_strlen(reply->message));
}
else{
STRNCPY(reply->message, buffer, reply->cMessage);
@@ -1532,8 +1532,8 @@ void AddHistoryEvent(DBEVENTINFO *dbEvent, char *contact, PReply reply) if (reply->message[0] != 0)
{
- strncat(reply->message, "\n", reply->cMessage);
- strncat(reply->message, buffer, reply->cMessage);
+ strncat(reply->message, "\n", reply->cMessage - mir_strlen(reply->message));
+ strncat(reply->message, buffer, reply->cMessage - mir_strlen(reply->message));
}
else{
STRNCPY(reply->message, buffer, reply->cMessage);
@@ -1586,8 +1586,8 @@ void HandleHistoryCommand(PCommand command, TArgument *argv, int argc, PReply re mir_snprintf(buffer, SIZEOF(buffer), Translate("%s:%s - %d unread events."), contact, protocol, count);
if (contacts > 0) {
- strncat(reply->message, "\n", reply->cMessage);
- strncat(reply->message, buffer, reply->cMessage);
+ strncat(reply->message, "\n", reply->cMessage - mir_strlen(reply->message));
+ strncat(reply->message, buffer, reply->cMessage - mir_strlen(reply->message));
}
else STRNCPY(reply->message, buffer, reply->cMessage);
|