diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/string.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/string.cpp b/src/string.cpp index b13378b2a..12e6b5823 100644 --- a/src/string.cpp +++ b/src/string.cpp @@ -9,6 +9,7 @@ #include "macros.h" #include "table/control_codes.h" #include "helpers.hpp" +#include "debug.h" #include <stdarg.h> #include <ctype.h> // required for tolower() @@ -47,11 +48,14 @@ char* strecpy(char* dst, const char* src, const char* last) assert(dst <= last); for (; *src != '\0' && dst != last; ++dst, ++src) *dst = *src; *dst = '\0'; -#if 1 if (dst == last && *src != '\0') { +#ifdef STRGEN error("String too long for destination buffer"); +#else /* STRGEN */ + DEBUG(misc, 0, "String too long for destination buffer"); + *dst = '\0'; +#endif /* STRGEN */ } -#endif return dst; } |