>Previous versions of the POSIX standard made no limitations on strcpy()
>but the current standard claims that using strcpy() with overlapping
>buffers gives undefined results.

Even the Single UNIX ® Specification, Version 2, says:

    If copying takes place between objects that overlap, the behaviour
    is undefined. 

So I don't think it's a new limitation.


>Most existing programs have been written before the standard was changed
>and I know of a lot of places where strcpy() is called with overlapping buffers
>in order to e.g. deal with escaped strings.

I understand what you mean.  Clearly the standard says that this is 
undefined but the practice that it works when copying overlapped strings
in such a way that a naive implementation would get it right.


I've not seen the issue and a short example would be nice to see.

Casper

_______________________________________________
opensolaris-code mailing list
opensolaris-code@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to