bin/xbps-pkgdb/check_pkg_symlinks.c: buffer not NUL terminated (CID 62665)

This commit is contained in:
Juan RP 2014-10-05 07:43:39 +02:00
parent b5713ecf12
commit 810c5d8de0

View File

@ -106,10 +106,10 @@ check_pkg_symlinks(struct xbps_handle *xhp, const char *pkgname, void *arg)
snprintf(path, sizeof(path), "%s%s", xhp->rootdir, file); snprintf(path, sizeof(path), "%s%s", xhp->rootdir, file);
snprintf(tgt_path, sizeof(tgt_path), "%s%s", xhp->rootdir, tgt); snprintf(tgt_path, sizeof(tgt_path), "%s%s", xhp->rootdir, tgt);
strncpy(tgt_path, tgt, sizeof(tgt_path)); strncpy(tgt_path, tgt, sizeof(tgt_path)-1);
} else { } else {
strncpy(path, file, sizeof(path)); strncpy(path, file, sizeof(path)-1);
strncpy(tgt_path, tgt, sizeof(tgt_path)); strncpy(tgt_path, tgt, sizeof(tgt_path)-1);
} }
if ((lnk = symlink_target(pkgname, path)) == NULL) if ((lnk = symlink_target(pkgname, path)) == NULL)