Skip to content

Commit b640b8f

Browse files
committed
Bug #48866: mysql.test fails under Fedora 12
strmov() is not guaranteed to work correctly on overlapping source and destination buffers. On some OSes it may work, but Fedora 12 has a stpcpy() that's not working correctly on overlapping buffers. Fixed to use the overlap-safe version of strmov instead. Re-vitalized the overlap-safe version of strmov.
1 parent 01cfb57 commit b640b8f

File tree

3 files changed

+5
-12
lines changed

3 files changed

+5
-12
lines changed

client/mysql.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4108,7 +4108,7 @@ char *get_arg(char *line, my_bool get_next_arg)
41084108
if (*ptr == '\\' && ptr[1]) // escaped character
41094109
{
41104110
// Remove the backslash
4111-
strmov(ptr, ptr+1);
4111+
strmov_overlapp(ptr, ptr+1);
41124112
}
41134113
else if ((!quoted && *ptr == ' ') || (quoted && *ptr == qtype))
41144114
{

include/m_string.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,7 @@ extern char NEAR _dig_vec_lower[];
108108
/* Defined in strtod.c */
109109
extern const double log_10[309];
110110

111-
#ifdef BAD_STRING_COMPILER
112-
#define strmov(A,B) (memccpy(A,B,0,INT_MAX)-1)
113-
#else
111+
#ifndef strmov
114112
#define strmov_overlapp(A,B) strmov(A,B)
115113
#define strmake_overlapp(A,B,C) strmake(A,B,C)
116114
#endif
@@ -171,12 +169,11 @@ extern uint strinstr(const char *str,const char *search);
171169
extern uint r_strinstr(reg1 my_string str,int from, reg4 my_string search);
172170
extern char *strkey(char *dst,char *head,char *tail,char *flags);
173171
extern char *strmake(char *dst,const char *src,uint length);
174-
#ifndef strmake_overlapp
175-
extern char *strmake_overlapp(char *dst,const char *src, uint length);
176-
#endif
177172

178173
#ifndef strmov
179174
extern char *strmov(char *dst,const char *src);
175+
#else
176+
extern char *strmov_overlapp(char *dst,const char *src);
180177
#endif
181178
extern char *strnmov(char *dst,const char *src,uint n);
182179
extern char *strsuff(const char *src,const char *suffix);

strings/strmov.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,11 @@
2424
#include <my_global.h>
2525
#include "m_string.h"
2626

27-
#ifdef BAD_STRING_COMPILER
27+
#ifdef strmov
2828
#undef strmov
2929
#define strmov strmov_overlapp
3030
#endif
3131

32-
#ifndef strmov
33-
3432
#if !defined(MC68000) && !defined(DS90)
3533

3634
char *strmov(register char *dst, register const char *src)
@@ -53,5 +51,3 @@ char *strmov(dst, src)
5351
}
5452

5553
#endif
56-
57-
#endif /* strmov */

0 commit comments

Comments
 (0)