From 8d0f183de07090823397b51d20cfa2dad4cf448d Mon Sep 17 00:00:00 2001 From: fengzero Date: Fri, 11 Nov 2022 06:38:34 +0000 Subject: [PATCH 1/2] fix: name length check --- plugins/restful/adapter_handle.c | 2 +- plugins/restful/group_config_handle.c | 2 +- src/adapter/driver/driver.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/restful/adapter_handle.c b/plugins/restful/adapter_handle.c index fb52a515..89588615 100644 --- a/plugins/restful/adapter_handle.c +++ b/plugins/restful/adapter_handle.c @@ -37,7 +37,7 @@ void handle_add_adapter(nng_aio *aio) REST_PROCESS_HTTP_REQUEST_VALIDATE_JWT( aio, neu_json_add_node_req_t, neu_json_decode_add_node_req, { - if (strlen(req->name) > NEU_NODE_NAME_LEN) { + if (strlen(req->name) >= NEU_NODE_NAME_LEN) { NEU_JSON_RESPONSE_ERROR(NEU_ERR_NODE_NAME_TOO_LONG, { http_response(aio, NEU_ERR_NODE_NAME_TOO_LONG, result_error); diff --git a/plugins/restful/group_config_handle.c b/plugins/restful/group_config_handle.c index a8a4652a..7ee70ab5 100644 --- a/plugins/restful/group_config_handle.c +++ b/plugins/restful/group_config_handle.c @@ -36,7 +36,7 @@ void handle_add_group_config(nng_aio *aio) REST_PROCESS_HTTP_REQUEST_VALIDATE_JWT( aio, neu_json_add_group_config_req_t, neu_json_decode_add_group_config_req, { - if (strlen(req->group) > NEU_GROUP_NAME_LEN) { + if (strlen(req->group) >= NEU_GROUP_NAME_LEN) { NEU_JSON_RESPONSE_ERROR(NEU_ERR_GROUP_NAME_TOO_LONG, { http_response(aio, NEU_ERR_GROUP_NAME_TOO_LONG, result_error); diff --git a/src/adapter/driver/driver.c b/src/adapter/driver/driver.c index b1c82a71..c97031b7 100644 --- a/src/adapter/driver/driver.c +++ b/src/adapter/driver/driver.c @@ -506,11 +506,11 @@ int neu_adapter_driver_add_tag(neu_adapter_driver_t *driver, const char *group, return NEU_ERR_TAG_NAME_TOO_LONG; } - if (strlen(tag->address) > NEU_TAG_ADDRESS_LEN) { + if (strlen(tag->address) >= NEU_TAG_ADDRESS_LEN) { return NEU_ERR_TAG_ADDRESS_TOO_LONG; } - if (strlen(tag->description) > NEU_TAG_DESCRIPTION_LEN) { + if (strlen(tag->description) >= NEU_TAG_DESCRIPTION_LEN) { return NEU_ERR_TAG_DESCRIPTION_TOO_LONG; } From 7b02d6936e76c20dc04dcf11aa73f6fabe302953 Mon Sep 17 00:00:00 2001 From: fengzero Date: Fri, 11 Nov 2022 06:40:47 +0000 Subject: [PATCH 2/2] version: 2.2.9 --- version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version b/version index eb430cbb..72d132f7 100644 --- a/version +++ b/version @@ -1 +1 @@ -2.2.8 \ No newline at end of file +2.2.9 \ No newline at end of file