diff options
-rw-r--r-- | src/console.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/console.cpp b/src/console.cpp index 60851cc2f..3cc11f31b 100644 --- a/src/console.cpp +++ b/src/console.cpp @@ -388,8 +388,9 @@ IConsoleAlias *IConsoleAliasGet(const char *name) /** copy in an argument into the aliasstream */ static inline int IConsoleCopyInParams(char *dst, const char *src, uint bufpos) { - int len = min(ICON_MAX_STREAMSIZE - bufpos, (uint)strlen(src)); - strecpy(dst, src, dst + len - 1); + /* len is the amount of bytes to add excluding the '\0'-termination */ + int len = min(ICON_MAX_STREAMSIZE - bufpos - 1, (uint)strlen(src)); + strecpy(dst, src, dst + len); return len; } |