Page MenuHomeFreeBSD

memcpy.3: remove BUGS section allowing overlapping strings

Authored by emaste on Thu, Jul 15, 2:12 PM.



The removed text claimed that memcpy is implemented using bcopy and thus strings may overlap. That was not actually true (although the implementation may have behaved as if so).

In any case it is undefined behavior according to the C standard, and this man page already claimed that src and dst may not overlap. Just remove the extra text that permits overlapping.

Diff Detail

Lint Skipped
Unit Tests Skipped

Event Timeline

emaste created this revision.

I do not object, but we need to coordinate due to D31180

This revision is now accepted and ready to land.Thu, Jul 15, 2:34 PM

Mentioning how it is implemented is definitely a manpage bug, but ultimately the implementation allows for overlapping strings and this can't be changed because userspace expects it. There is a famous glibc bugreport where memcpy was patched to no longer allow overlapping stores and that broke tons of stuff. This had to get worse since then.

I think a note that overlapping stores are supported due to overall breakage is prudent, but I don't know how to nicely word it.