Skip to content
5 changes: 5 additions & 0 deletions src/db.c
Original file line number Diff line number Diff line change
Expand Up @@ -2331,6 +2331,11 @@ int db_col_rule_add(struct db_filter_col *col,
rc = -EINVAL;
goto add_return;
}
/* Check that no unknown flags are specified in the op */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be a good idea to check this up near the top of the if-block once the once the chain entry is considered valid (the fail early idea).

if ((arg_data.op & ~(SCMP_CMP_OPMASK | SCMP_CMP_32BIT)) != 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may argue for a SCMP_CMP_FLAGMASK or similar, see the comments on the first patch in the PR.

rc = -EINVAL;
goto add_return;
}
} else {
rc = -EINVAL;
goto add_return;
Expand Down