kern___realpathat(): do not copyout past end of string
(cherry picked from commit 67218bcea847c93ccd002335748884b02a3ca807)