From: Roy Marples Date: Tue, 30 Dec 2025 21:36:24 +0000 (+0000) Subject: options: Ensure that an overly long bitflag string does not crash (#576) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=33df3ed00b85ce9fa68369dc7f416bb03f3e00bb;p=thirdparty%2Fdhcpcd.git options: Ensure that an overly long bitflag string does not crash (#576) Fixes #573. --- 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 @@ err_sla: 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);