mirror of
https://github.com/MariaDB/server.git
synced 2025-01-15 19:42:28 +01:00
MDEV-11752 Unsafe strmov - function definition in include/m_string.h
assert that strmov() cannot be used on overlapping strings. (because strpcpy cannot)
This commit is contained in:
parent
e0a03ca30a
commit
5d40ed864e
3 changed files with 4 additions and 1 deletions
|
@ -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[];
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue