]> git.ipfire.org Git - people/mlorenz/ipfire-2.x.git/blame - src/patches/dhcpcd-10.0.2-fix-off-by-one-overflow-when-read.patch
dhcpcd: Fix buffer overflow at startup
[people/mlorenz/ipfire-2.x.git] / src / patches / dhcpcd-10.0.2-fix-off-by-one-overflow-when-read.patch
CommitLineData
8d5a43f0
MT
1From f798bf23af8e5a0eae38931912e2b67e1d45aca4 Mon Sep 17 00:00:00 2001
2From: Tobias Heider <tobhe@users.noreply.github.com>
3Date: Sat, 12 Aug 2023 21:59:21 +0200
4Subject: [PATCH] dhcpcd: Fix off-by-one overflow when read() writes full
5 BUFSIZ (#236)
6
7---
8 src/dhcpcd.c | 2 +-
9 1 file changed, 1 insertion(+), 1 deletion(-)
10
11diff --git a/src/dhcpcd.c b/src/dhcpcd.c
12index e06733d3..688a3a6d 100644
13--- a/src/dhcpcd.c
14+++ b/src/dhcpcd.c
15@@ -1822,7 +1822,7 @@ dhcpcd_stderr_cb(void *arg, unsigned short events)
16 if (!(events & ELE_READ))
17 return;
18
19- len = read(ctx->stderr_fd, log, sizeof(log));
20+ len = read(ctx->stderr_fd, log, sizeof(log) - 1);
21 if (len == -1) {
22 if (errno != ECONNRESET)
23 logerr(__func__);
24--
252.39.2
26