Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
pkg_open2: prevent a bad usage to happen
Baptiste Daroussin committed 4 years ago
commit 584eae0a35321e8da0071a3d9e9a7407ccbf7883
parent 4eda786
1 file changed +5 -0
modified libpkg/pkg.c
@@ -1369,6 +1369,11 @@ pkg_open2(struct pkg **pkg_p, struct archive **a, struct archive_entry **ae,
	 * other leading path. */

	if (fd == -1) {
+
		if (path == NULL) {
+
			pkg_emit_error("bad usage of pkg_open2");
+
			retcode = EPKG_FATAL;
+
			goto cleanup;
+
		}
		read_from_stdin = (strncmp(path, "-", 2) == 0);

		if (archive_read_open_filename(*a,