summaryrefslogtreecommitdiff
path: root/MySpace/formatting.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'MySpace/formatting.cpp')
-rw-r--r--MySpace/formatting.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/MySpace/formatting.cpp b/MySpace/formatting.cpp
index d6b4055..7bd8325 100644
--- a/MySpace/formatting.cpp
+++ b/MySpace/formatting.cpp
@@ -81,7 +81,7 @@ char *symbols[25] = {":D", ":E", "X(", ":O", ":p", "}:)", ":)", "X)", ":{", "B|"
":X", "Q)", ":B", ";-)", "B)", ":))", ":G", ":,", ":[", "%)", "-:", "P)", ":|", ":X"};
void encode_smileys(char *buff, int size) {
- char *tmp = new char[size];
+ char *tmp = new char[size + 1];
int in = 0, out = 0;
char sb[128];
@@ -105,8 +105,8 @@ void encode_smileys(char *buff, int size) {
}
tmp[out] = 0;
- strncpy(buff, tmp, size);
- delete tmp;
+ strncpy(buff, tmp, out + 1);
+ delete[] tmp;
buff[size - 1] = 0;
}