DIR *dirp;
struct dirent *dp;
- strncpy(buf, dir, PATH_MAX);
- buf[PATH_MAX - 1] = '\0';
+ xstrncpy(buf, dir, PATH_MAX);
d = strchr(buf, '*');
if (!d)
/* canonicalize pattern -- remove path suffix etc. */
p = strrchr(pattern, '/');
p = p ? p + 1 : (char *) pattern;
- strncpy(patbuf, p, PATH_MAX);
- patbuf[PATH_MAX - 1] = '\0';
+ xstrncpy(patbuf, p, PATH_MAX);
DBG(SEARCH, ul_debug("lookup dirs for '%s' (%s), want: %s %s %s",
patbuf, pattern,