dns: validate arguments in resolve

Mitigat  C++-land assertion error, add test accordingly.

fix #7070