[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-devel
Subject:    Re: msvcrt: dont overlap in strcpy (valgrind)
From:       Vitaliy Margolen <wine-devel () kievinfo ! com>
Date:       2009-10-30 3:16:58
Message-ID: 4AEA5AAA.1050208 () kievinfo ! com
[Download RAW message or body]

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.



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic