From 07ef43df33d4b768bc93e0961b905c459d3ece6d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Thomas=20Wei=C3=9Fschuh?= Date: Fri, 22 Sep 2023 11:19:37 +0200 Subject: [PATCH] lib/env: avoid underflow of read_all_alloc() return value MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit read_all_alloc() returns a negative error on failure. When casting this to an unsigned type the failure check "< 1" will not work. Signed-off-by: Thomas Weißschuh --- lib/env.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/env.c b/lib/env.c index 2ccabff6fc..2b3395c53b 100644 --- a/lib/env.c +++ b/lib/env.c @@ -90,7 +90,7 @@ static struct ul_env_list *env_list_add(struct ul_env_list *ls0, const char *str struct ul_env_list *env_from_fd(int fd) { char *buf = NULL, *p; - size_t rc = 0; + ssize_t rc = 0; struct ul_env_list *ls = NULL; if ((rc = read_all_alloc(fd, &buf)) < 1) -- 2.47.2