options: Ensure that an overly long bitflag string does not crash

Fixes #573.
This commit is contained in:
Roy Marples 2025-12-30 07:52:43 +00:00
parent 63bfc6d296
commit e92ba41e9b

View File

@ -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);