]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
dhcpcd: Fix off-by-one overflow when read() writes full BUFSIZ (#236)
authorTobias Heider <tobhe@users.noreply.github.com>
Sat, 12 Aug 2023 19:59:21 +0000 (21:59 +0200)
committerGitHub <noreply@github.com>
Sat, 12 Aug 2023 19:59:21 +0000 (20:59 +0100)
src/dhcpcd.c

index e06733d318bc30ad6f5af7af849a2067224b9d4f..688a3a6d3d5b61183732484aba3de943edd3841a 100644 (file)
@@ -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__);