Radish alpha
H
HardenedBSD Package Manager
Radicle
Git (anonymous pull)
Log in to clone via SSH
When reading files tagged as @config from archives, don't forget to null terminate the buffer we read from libarchive. The @config system uses c-strings, not byte counted buffers.
Peter Wemm committed 10 years ago
commit b2d71b3b04bca41cf9ce030ce1e916cc631a69b6
parent 066fb7aec74a82747ce105cebe51f692e8380b6e
1 file changed +2 -1
modified libpkg/pkg_add.c
@@ -216,8 +216,9 @@ do_extract(struct archive *a, struct archive_entry *ae, const char *location,
		if (pkg_is_config_file(pkg, path, &rf, &rcf)) {
			pkg_debug(1, "Populating config_file %s", pathname);
			size_t len = archive_entry_size(ae);
-
			rcf->content = malloc(len);
+
			rcf->content = malloc(len + 1);
			archive_read_data(a, rcf->content, len);
+
			rcf->content[len] = '\0';
			if (renamed && (!automerge || local == NULL))
				strlcat(pathname, ".pkgnew", sizeof(pathname));
		}