s/strncpy/strlcpy/ and also adjust the length argument