By the time, __orig_strcpy is called, the length has already been computed and has been established to be in bound. There's no need to pay for the nul-byte search again inside of __orig_strcpy when the faster memcpy can be called instead.
Some of the other str* functions suffer from the same issue.
For example, in
strcpy
(ignoring the UB overlapping check):https://github.com/jvoisin/fortify-headers/blob/9aa4490263ead62dc545cf0e8b83e0ef77eb7a6e/include/string.h#L139-L150
By the time,
__orig_strcpy
is called, the length has already been computed and has been established to be in bound. There's no need to pay for the nul-byte search again inside of__orig_strcpy
when the fastermemcpy
can be called instead.Some of the other
str*
functions suffer from the same issue.