fix aliasing-based undefined behavior in string functions
authorRich Felker <dalias@aerifal.cx>
Wed, 26 Sep 2018 18:39:10 +0000 (14:39 -0400)
committerRich Felker <dalias@aerifal.cx>
Wed, 26 Sep 2018 18:39:10 +0000 (14:39 -0400)
commit4d0a82170a25464c39522d7190b9fe302045ddb2
treeb3a469567ed3a995300c9751b824ef20b84f154d
parent8cd738bbee3b4e60a99b71599c338bf444070f18
fix aliasing-based undefined behavior in string functions

use the GNU C may_alias attribute if available, and fallback to naive
byte-by-byte loops if __GNUC__ is not defined.

this patch has been written to minimize changes so that history
remains reviewable; it does not attempt to bring the affected code
into a more consistent or elegant form.
src/string/memccpy.c
src/string/memchr.c
src/string/memmove.c
src/string/stpcpy.c
src/string/stpncpy.c
src/string/strchrnul.c
src/string/strlcpy.c
src/string/strlen.c