]> 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)
committerRoy Marples <roy@marples.name>
Wed, 23 Aug 2023 09:11:14 +0000 (10:11 +0100)
src/dhcpcd.c

index 838befb63ac3826a4c705cff013856c6646053b1..d47a0f4f686edffdeeb45f4c1ca88e27a6954069 100644 (file)
@@ -1794,7 +1794,7 @@ dhcpcd_stderr_cb(void *arg)
        char log[BUFSIZ];
        ssize_t len;
 
-       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__);