The branch main has been updated by bapt:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=635eb7ac7990a2bb29e1992b739617a9db012bf2

commit 635eb7ac7990a2bb29e1992b739617a9db012bf2
Author:     Baptiste Daroussin <b...@freebsd.org>
AuthorDate: 2021-09-09 14:48:21 +0000
Commit:     Baptiste Daroussin <b...@freebsd.org>
CommitDate: 2021-09-09 14:51:26 +0000

    fetch: do not confuse capacity and length
    
    The patch converting fetch to getline
    (ee3ca711a898cf41330c320826ea1e0e6e451f1d),
    did confuse the capacity of the line buffer with the actual len of the read
    line confusing fetch -v.
---
 lib/libfetch/http.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/libfetch/http.c b/lib/libfetch/http.c
index 61f0f393ed98..bcb089dc0fc4 100644
--- a/lib/libfetch/http.c
+++ b/lib/libfetch/http.c
@@ -1526,12 +1526,13 @@ http_get_proxy(struct url * url, const char *flags)
 static void
 http_print_html(FILE *out, FILE *in)
 {
-       size_t len = 0;
+       ssize_t len = 0;
+       size_t cap;
        char *line = NULL, *p, *q;
        int comment, tag;
 
        comment = tag = 0;
-       while (getline(&line, &len, in) >= 0) {
+       while ((len = getline(&line, &cap, in)) >= 0) {
                while (len && isspace((unsigned char)line[len - 1]))
                        --len;
                for (p = q = line; q < line + len; ++q) {
_______________________________________________
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"

Reply via email to