The magic offset and size are both uint32_t, so their sum may wrap and
pass the IBE_MATCH_MAX check with an offset far outside of the image
header. Any exec that's checked against such an entry will then read
well beyond the header.
The name and interpreter length checks also read the byte following the
string before checking its index, so either one may fill its field
without a terminating NUL as long as the next field starts with one. A
full-length interpreter then overflows the normalization buffer in
imgact_binmisc_populate_interp() by a byte. An unterminated name is
instead truncated, which lets the same name be added more than once
since the duplicate check compares against the truncated copy.
Avoid the wrap and require both strings to be terminated within their
fields, and add regression tests for each. Note that these are only
reachable by root on the host.