msvcrt: dont overlap in strcpy (valgrind)

Vitaliy Margolen wine-devel at kievinfo.com
Thu Oct 29 22:16:58 CDT 2009


André Hentschel wrote:
> here is a case where valgrind claims about "Source and destination overlap in strcpy".
>      snprintf(data->efcvt_buffer, 80, "%.*le", prec - 1, number);
>      /* take the decimal "point away */
>      if( prec != 1)
> -        strcpy( data->efcvt_buffer + 1, data->efcvt_buffer + 2);
> +        {
> +            char *src = data->efcvt_buffer + 2, *dest = data->efcvt_buffer + 1;
> +            while ((*dest++=*src++) != 0);
> +        }
You should use memmove instead.

Vitaliy.



More information about the wine-devel mailing list