mirror of
https://github.com/espressif/openthread.git
synced 2026-08-10 04:37:47 +00:00
[dns-client] add arg validation on ResolveService() (#6194)
This commit is contained in:
@@ -434,15 +434,16 @@ typedef void (*otDnsServiceCallback)(otError aError, const otDnsServiceResponse
|
||||
* the config for this query. In a non-NULL @p aConfig, some of the fields can be left unspecified (value zero). The
|
||||
* unspecified fields are then replaced by the values from the default config.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aInstanceLabel The service instance label.
|
||||
* @param[in] aServiceName The service name (together with @p aInstanceLabel form full instance name).
|
||||
* @param[in] aCallback A function pointer that shall be called on response reception or time-out.
|
||||
* @param[in] aContext A pointer to arbitrary context information.
|
||||
* @param[in] aConfig A pointer to the config to use for this query.
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aInstanceLabel The service instance label.
|
||||
* @param[in] aServiceName The service name (together with @p aInstanceLabel form full instance name).
|
||||
* @param[in] aCallback A function pointer that shall be called on response reception or time-out.
|
||||
* @param[in] aContext A pointer to arbitrary context information.
|
||||
* @param[in] aConfig A pointer to the config to use for this query.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Query sent successfully. @p aCallback will be invoked to report the status.
|
||||
* @retval OT_ERROR_NO_BUFS Insufficient buffer to prepare and send query.
|
||||
* @retval OT_ERROR_NONE Query sent successfully. @p aCallback will be invoked to report the status.
|
||||
* @retval OT_ERROR_NO_BUFS Insufficient buffer to prepare and send query.
|
||||
* @retval OT_ERROR_INVALID_ARGS @p aInstanceLabel is NULL.
|
||||
*
|
||||
*/
|
||||
otError otDnsClientResolveService(otInstance * aInstance,
|
||||
|
||||
@@ -53,7 +53,7 @@ extern "C" {
|
||||
* @note This number versions both OpenThread platform and user APIs.
|
||||
*
|
||||
*/
|
||||
#define OPENTHREAD_API_VERSION (77)
|
||||
#define OPENTHREAD_API_VERSION (78)
|
||||
|
||||
/**
|
||||
* @addtogroup api-instance
|
||||
|
||||
@@ -514,12 +514,18 @@ otError Client::ResolveService(const char * aInstanceLabel,
|
||||
const QueryConfig *aConfig)
|
||||
{
|
||||
QueryInfo info;
|
||||
otError error;
|
||||
|
||||
VerifyOrExit(aInstanceLabel != nullptr, error = OT_ERROR_INVALID_ARGS);
|
||||
|
||||
info.Clear();
|
||||
info.mQueryType = kServiceQuery;
|
||||
info.mCallback.mServiceCallback = aCallback;
|
||||
|
||||
return StartQuery(info, aConfig, aInstanceLabel, aServiceName, aContext);
|
||||
error = StartQuery(info, aConfig, aInstanceLabel, aServiceName, aContext);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
#endif // OPENTHREAD_CONFIG_DNS_CLIENT_SERVICE_DISCOVERY_ENABLE
|
||||
|
||||
@@ -586,17 +586,17 @@ public:
|
||||
* The @p aConfig can be nullptr. In this case the default config (from `GetDefaultConfig()`) will be used as
|
||||
* the config for this query. In a non-nullptr @p aConfig, some of the fields can be left unspecified (value zero).
|
||||
* The unspecified fields are then replaced by the values from the default config.
|
||||
|
||||
*
|
||||
* @param[in] aServerSockAddr The server socket address.
|
||||
* @param[in] aInstanceLabel The service instance label.
|
||||
* @param[in] aServiceName The service name (together with @p aInstanceLabel form full instance name).
|
||||
* @param[in] aCallback A function pointer that shall be called on response reception or time-out.
|
||||
* @param[in] aContext A pointer to arbitrary context information.
|
||||
* @param[in] aConfig The config to use for this query.
|
||||
* @param[in] aServerSockAddr The server socket address.
|
||||
* @param[in] aInstanceLabel The service instance label.
|
||||
* @param[in] aServiceName The service name (together with @p aInstanceLabel form full instance name).
|
||||
* @param[in] aCallback A function pointer that shall be called on response reception or time-out.
|
||||
* @param[in] aContext A pointer to arbitrary context information.
|
||||
* @param[in] aConfig The config to use for this query.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Query sent successfully. @p aCallback will be invoked to report the status.
|
||||
* @retval OT_ERROR_NO_BUFS Insufficient buffer to prepare and send query.
|
||||
* @retval OT_ERROR_NONE Query sent successfully. @p aCallback will be invoked to report the status.
|
||||
* @retval OT_ERROR_NO_BUFS Insufficient buffer to prepare and send query.
|
||||
* @retval OT_ERROR_INVALID_ARGS @p aInstanceLabel is `nullptr`.
|
||||
*
|
||||
*/
|
||||
otError ResolveService(const char * aInstanceLabel,
|
||||
|
||||
Reference in New Issue
Block a user