Use strlcpy(3) and strlcat(3). There is a couple left.