lib/repo.c: CID 62757 (toctou)
This commit is contained in:
parent
805f6aa1b2
commit
513f8a2bae
11
lib/repo.c
11
lib/repo.c
@ -142,12 +142,6 @@ xbps_repo_open(struct xbps_handle *xhp, const char *url, bool lock)
|
|||||||
/* local repository */
|
/* local repository */
|
||||||
repofile = xbps_repo_path(xhp, url);
|
repofile = xbps_repo_path(xhp, url);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stat(repofile, &st) == -1) {
|
|
||||||
xbps_dbg_printf(xhp, "[repo] `%s' stat repodata %s\n",
|
|
||||||
repofile, strerror(errno));
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* Open or create the repository archive.
|
* Open or create the repository archive.
|
||||||
*/
|
*/
|
||||||
@ -169,6 +163,11 @@ xbps_repo_open(struct xbps_handle *xhp, const char *url, bool lock)
|
|||||||
xbps_dbg_printf(xhp, "[repo] failed to lock %s: %s\n", repo->uri, strerror(errno));
|
xbps_dbg_printf(xhp, "[repo] failed to lock %s: %s\n", repo->uri, strerror(errno));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
if (fstat(repo->fd, &st) == -1) {
|
||||||
|
xbps_dbg_printf(xhp, "[repo] `%s' fstat repodata %s\n",
|
||||||
|
repofile, strerror(errno));
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
repo->ar = archive_read_new();
|
repo->ar = archive_read_new();
|
||||||
archive_read_support_compression_gzip(repo->ar);
|
archive_read_support_compression_gzip(repo->ar);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user