diff --git a/src/console.cpp b/src/console.cpp index 350dd95fdb..0be9c8cbae 100644 --- a/src/console.cpp +++ b/src/console.cpp @@ -696,8 +696,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; }