Use memmove() where ranges may overlap. Fixes #200 (Matthew Dempsky).

This commit is contained in:
Keith Winstein
2012-04-16 18:22:27 -04:00
parent 68825dccde
commit c8951c7dfd
+1 -1
View File
@@ -116,7 +116,7 @@ std::list<Parser::Action *> Parser::UTF8Parser::input( char c )
} else if ( bytes_parsed > 0 ) { } else if ( bytes_parsed > 0 ) {
/* parsed into pwc, accept */ /* parsed into pwc, accept */
assert( bytes_parsed <= buf_len ); assert( bytes_parsed <= buf_len );
memcpy( buf, buf + bytes_parsed, buf_len - bytes_parsed ); memmove( buf, buf + bytes_parsed, buf_len - bytes_parsed );
buf_len = buf_len - bytes_parsed; buf_len = buf_len - bytes_parsed;
} else { } else {
throw std::string( "Unknown return value from mbrtowc" ); throw std::string( "Unknown return value from mbrtowc" );