diff --git a/dbug/dbug.c b/dbug/dbug.c index b2b298beb09..3035895648e 100644 --- a/dbug/dbug.c +++ b/dbug/dbug.c @@ -1883,7 +1883,7 @@ static void DBUGOpenFile(CODE_STATE *cs, cs->stack->name[len]=0; } else - strmov(cs->stack->name,name); + strmov(cs->stack->name,name); name=cs->stack->name; if (strcmp(name, "-") == 0) { diff --git a/include/m_string.h b/include/m_string.h index 969725e4631..7437ea8b7cd 100644 --- a/include/m_string.h +++ b/include/m_string.h @@ -73,11 +73,13 @@ extern void *(*my_str_malloc)(size_t); extern void *(*my_str_realloc)(void *, size_t); extern void (*my_str_free)(void *); +#ifdef DBUG_OFF #if defined(HAVE_STPCPY) && MY_GNUC_PREREQ(3, 4) && !defined(__INTEL_COMPILER) #define strmov(A,B) __builtin_stpcpy((A),(B)) #elif defined(HAVE_STPCPY) #define strmov(A,B) stpcpy((A),(B)) #endif +#endif /* Declared in int2str() */ extern const char _dig_vec_upper[]; diff --git a/strings/strmov.c b/strings/strmov.c index b38d5db5d6e..0f594185688 100644 --- a/strings/strmov.c +++ b/strings/strmov.c @@ -40,6 +40,7 @@ char *strmov(register char *dst, register const char *src) { + DBUG_ASSERT(src + strlen(src) < dst || dst + strlen(src) < src); while ((*dst++ = *src++)) ; return dst-1; }