diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc index 9cc77d50906a51..08703fcf542a4b 100644 --- a/src/cares_wrap.cc +++ b/src/cares_wrap.cc @@ -1601,7 +1601,10 @@ void GetAddrInfo(const FunctionCallbackInfo& args) { } Local order; - args[4]->ToUint32(env->context()).ToLocal(&order); + if (!args[4]->ToUint32(env->context()).ToLocal(&order)) { + THROW_ERR_INVALID_ARG_VALUE(env, "bad order"); + return; + } auto req_wrap = std::make_unique(env, req_wrap_obj,