Re: msvcrt: dont overlap in strcpy (valgrind)
29 Oct
2009
29 Oct
'09
10:16 p.m.
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.
5888
Age (days ago)
5888
Last active (days ago)
0 comments
1 participants
participants (1)
-
Vitaliy Margolen