From: Tobias Heider Date: Sat, 12 Aug 2023 19:59:21 +0000 (+0200) Subject: dhcpcd: Fix off-by-one overflow when read() writes full BUFSIZ (#236) X-Git-Tag: v10.0.3~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f798bf23af8e5a0eae38931912e2b67e1d45aca4;p=thirdparty%2Fdhcpcd.git dhcpcd: Fix off-by-one overflow when read() writes full BUFSIZ (#236) --- diff --git a/src/dhcpcd.c b/src/dhcpcd.c index e06733d3..688a3a6d 100644 --- a/src/dhcpcd.c +++ b/src/dhcpcd.c @@ -1822,7 +1822,7 @@ dhcpcd_stderr_cb(void *arg, unsigned short events) if (!(events & ELE_READ)) return; - len = read(ctx->stderr_fd, log, sizeof(log)); + len = read(ctx->stderr_fd, log, sizeof(log) - 1); if (len == -1) { if (errno != ECONNRESET) logerr(__func__);