Fixed issue with readlink function to prevent buffer-overflow