From e6f0a33e68efb4e2d30ee51bd452076827240ab1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Sun, 20 Jan 2002 19:53:12 +0000 Subject: [PATCH] Check the return value from read() when reading the CR/LF at the end of a chunk. PR: bin/33608 MFC after: 2 weeks --- lib/libfetch/http.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/libfetch/http.c b/lib/libfetch/http.c index 615896809ebd..04b7964612fe 100644 --- a/lib/libfetch/http.c +++ b/lib/libfetch/http.c @@ -195,8 +195,10 @@ _http_fillbuf(struct cookie *c) c->chunksize -= c->b_len; if (c->chunksize == 0) { - char endl[2]; - read(c->fd, endl, 2); + char endl; + if (read(c->fd, &endl, 1) == -1 || + read(c->fd, &endl, 1) == -1) + return -1; } c->b_pos = 0;