From e92ba41e9b4aff335ef8c95f89791dee2e942532 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Tue, 30 Dec 2025 07:52:43 +0000 Subject: [PATCH] options: Ensure that an overly long bitflag string does not crash Fixes #573. --- src/if-options.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/if-options.c b/src/if-options.c index 9ac9f0b8..b55e65d6 100644 --- a/src/if-options.c +++ b/src/if-options.c @@ -2130,6 +2130,10 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo, ndop->var = np; if (bp) { dl = strlen(bp); + if (dl > sizeof(ndop->bitflags)) { + logwarnx("bitflag string too long %s", bp); + dl = sizeof(ndop->bitflags); + } memcpy(ndop->bitflags, bp, dl); memset(ndop->bitflags + dl, 0, sizeof(ndop->bitflags) - dl);