]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
privsep: fix strlcpy overflow in psp_ifname (#239)
authorTobias Heider <tobhe@users.noreply.github.com>
Tue, 15 Aug 2023 16:06:48 +0000 (18:06 +0200)
committerGitHub <noreply@github.com>
Tue, 15 Aug 2023 16:06:48 +0000 (17:06 +0100)
When running our Ubuntu tests with libc6 and strlcpy overflow checks
enabled we found that the wrong size is passed to strlcpy resulting
in a crash because of an overflow.

src/privsep.c

index b11c0351c25e2189ff042bc7b5b5a923cc754e3c..cfe54742f5af3b3acc8b70ac063a528be8496ca3 100644 (file)
@@ -1200,7 +1200,7 @@ ps_newprocess(struct dhcpcd_ctx *ctx, struct ps_id *psid)
 #endif
 
        if (!(ctx->options & DHCPCD_MANAGER))
-               strlcpy(psp->psp_ifname, ctx->ifv[0], sizeof(psp->psp_name));
+               strlcpy(psp->psp_ifname, ctx->ifv[0], sizeof(psp->psp_ifname));
        TAILQ_INSERT_TAIL(&ctx->ps_processes, psp, next);
        return psp;
 }