dns: resolver: validate arguments

Closes #7070. Mitigates C++-land assertion error; adds tests
accordingly.