diff options
author | George Hazan <george.hazan@gmail.com> | 2015-05-28 15:43:44 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-05-28 15:43:44 +0000 |
commit | 7666c2ce26dd9a6e2fb129dea4d2fad9bcdbe591 (patch) | |
tree | e6fa63a806ef6e62e06ec56177a02898a9db9d6f /plugins/YahooGroups/src/services.cpp | |
parent | b894583716289087a7144fd770d1a5f96bca82cd (diff) |
unsafe strncat removed
git-svn-id: http://svn.miranda-ng.org/main/trunk@13874 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/YahooGroups/src/services.cpp')
-rw-r--r-- | plugins/YahooGroups/src/services.cpp | 43 |
1 files changed, 14 insertions, 29 deletions
diff --git a/plugins/YahooGroups/src/services.cpp b/plugins/YahooGroups/src/services.cpp index a5a0b01cfd..f13cd473ff 100644 --- a/plugins/YahooGroups/src/services.cpp +++ b/plugins/YahooGroups/src/services.cpp @@ -87,7 +87,7 @@ int GetNextGroupIndex() return index - 1;
}
-void AddNewGroup(char *newGroup)
+void AddNewGroup(const char *newGroup)
{
int index = GetNextGroupIndex();
@@ -119,44 +119,29 @@ void CreateGroup(char *group) {
char *p = group;
char *sub = group;
- char buffer[1024] = {0};
-
+
+ CMStringA buf;
while ((p = strchr(sub, '\\')))
{
*p = 0;
- if (mir_strlen(buffer) > 0)
- {
- mir_strncat(buffer, "\\", SIZEOF(buffer) - mir_strlen(buffer));
- mir_strncat(buffer, sub, SIZEOF(buffer) - mir_strlen(buffer));
- }
- else{
- strncpy_s(buffer, sub, _TRUNCATE);
- }
+ if (!buf.IsEmpty())
+ buf.AppendChar('\\');
+ buf.Append(sub);
- if (!availableGroups.Contains(buffer))
- {
- AddNewGroup(buffer);
- }
+ if (!availableGroups.Contains(buf))
+ AddNewGroup(buf);
*p++ = '\\';
sub = p;
}
- if (sub)
- {
- if (mir_strlen(buffer) > 0)
- {
- mir_strncat(buffer, "\\", SIZEOF(buffer) - mir_strlen(buffer));
- mir_strncat(buffer, sub, SIZEOF(buffer) - mir_strlen(buffer));
- }
- else{
- strncpy_s(buffer, sub, _TRUNCATE);
- }
+ if (sub) {
+ if (!buf.IsEmpty())
+ buf.AppendChar('\\');
+ buf.Append(sub);
- if (!availableGroups.Contains(buffer))
- {
- AddNewGroup(buffer);
- }
+ if (!availableGroups.Contains(buf))
+ AddNewGroup(buf);
}
}
|