Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Only read the needed size if smaller than BUFSIZ
Baptiste Daroussin committed 11 years ago
commit acfe63c3938b1a3096616414e66288fd2ed40135
parent 6b0a37c
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);