Radish alpha
H
HardenedBSD Package Manager
Radicle
Git (anonymous pull)
Log in to clone via SSH
Only read the needed size if smaller than BUFSIZ
Baptiste Daroussin committed 11 years ago
commit acfe63c3938b1a3096616414e66288fd2ed40135
parent 6b0a37c64f5777e830a199d1bbaa577ce0bf7117
1 file changed +2 -1
modified libpkg/fetch.c
@@ -602,7 +602,8 @@ pkg_fetch_file_to_fd(struct pkg_repo *repo, const char *url, int dest, time_t *t
		time_t	now;

		pkg_debug(1, "Reading status: %d over %d", done, sz);
-
		if ((r = fread(buf, 1, sizeof(buf), remote)) < 1)
+
		if ((r = fread(buf, 1, sz > sizeof(buf) ? sizeof(buf) : sz,
+
		    remote)) < 1)
			break;

		pkg_debug(1, "Read status: %d over %d", done, sz);