aboutsummaryrefslogtreecommitdiff
path: root/lib/libfetch/http.c
diff options
context:
space:
mode:
authorDaniel Kolesa <daniel@octaforge.org>2021-08-17 14:01:46 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2021-08-17 14:17:22 +0000
commitee3ca711a898cf41330c320826ea1e0e6e451f1d (patch)
tree85ad380774bbcda52a55d3b93b3bcc84c89276ba /lib/libfetch/http.c
parentaa68b3bb2e11392f4636b3656b0f0bcacec3385a (diff)
downloadsrc-ee3ca711a898cf41330c320826ea1e0e6e451f1d.tar.gz
src-ee3ca711a898cf41330c320826ea1e0e6e451f1d.zip
Diffstat (limited to 'lib/libfetch/http.c')
-rw-r--r--lib/libfetch/http.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/libfetch/http.c b/lib/libfetch/http.c
index e61e23b1425a..61f0f393ed98 100644
--- a/lib/libfetch/http.c
+++ b/lib/libfetch/http.c
@@ -1526,12 +1526,12 @@ http_get_proxy(struct url * url, const char *flags)
static void
http_print_html(FILE *out, FILE *in)
{
- size_t len;
- char *line, *p, *q;
+ size_t len = 0;
+ char *line = NULL, *p, *q;
int comment, tag;
comment = tag = 0;
- while ((line = fgetln(in, &len)) != NULL) {
+ while (getline(&line, &len, in) >= 0) {
while (len && isspace((unsigned char)line[len - 1]))
--len;
for (p = q = line; q < line + len; ++q) {
@@ -1559,6 +1559,8 @@ http_print_html(FILE *out, FILE *in)
fwrite(p, q - p, 1, out);
fputc('\n', out);
}
+
+ free(line);
}