diff options
author | Vladislavs Sokurenko <vladislavs.sokurenko@zabbix.com> | 2022-02-17 14:20:13 +0300 |
---|---|---|
committer | Vladislavs Sokurenko <vladislavs.sokurenko@zabbix.com> | 2022-02-17 14:20:13 +0300 |
commit | da34f02b4fc8710106e5f1c9395e1ccfbaccbd8b (patch) | |
tree | 058c01f8abc3b0664b78a89ae87f92755494a78d /src | |
parent | 3d1c2913ffad24723981d08216c608039779ab84 (diff) | |
parent | 42fc82dc8b502a7ebf92ade5a45e8d3b0ef5e452 (diff) |
.......PS. [ZBX-20325] fixed harmless use of unitialised value in preprocessing manager when single 'check for not supported value' step is used
Merge in ZBX/zabbix from feature/ZBX-20325-5.4 to release/5.4
* commit '42fc82dc8b502a7ebf92ade5a45e8d3b0ef5e452':
.D........ [ZBX-20325] fixed ChangeLog entry
.D........ [ZBX-20325] fixed ChangeLog entry
.......PS. [ZBXNEXT-7049] fixed crash in preprocessing manager when single 'check for not supported value' step is used
Diffstat (limited to 'src')
-rw-r--r-- | src/zabbix_server/preprocessor/preproc_manager.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/src/zabbix_server/preprocessor/preproc_manager.c b/src/zabbix_server/preprocessor/preproc_manager.c index 12c997634c8..46fa8ba1c18 100644 --- a/src/zabbix_server/preprocessor/preproc_manager.c +++ b/src/zabbix_server/preprocessor/preproc_manager.c @@ -714,20 +714,25 @@ static void preprocessor_enqueue(zbx_preprocessing_manager_t *manager, zbx_prepr if (REQUEST_STATE_QUEUED == state && 0 <= notsupp_shift) { request->value_type = item->value_type; - request->steps = (zbx_preproc_op_t *)zbx_malloc(NULL, sizeof(zbx_preproc_op_t) * - (item->preproc_ops_num - notsupp_shift)); - request->steps_num = item->preproc_ops_num - notsupp_shift; - - for (i = 0; i < item->preproc_ops_num - notsupp_shift; i++) + if (0 < item->preproc_ops_num - notsupp_shift) { - request->steps[i].type = item->preproc_ops[i + notsupp_shift].type; - request->steps[i].params = zbx_strdup(NULL, item->preproc_ops[i + notsupp_shift].params); - request->steps[i].error_handler = item->preproc_ops[i + notsupp_shift].error_handler; - request->steps[i].error_handler_params = zbx_strdup(NULL, - item->preproc_ops[i + notsupp_shift].error_handler_params); - } + request->steps = (zbx_preproc_op_t *)zbx_malloc(NULL, sizeof(zbx_preproc_op_t) * + (item->preproc_ops_num - notsupp_shift)); + request->steps_num = item->preproc_ops_num - notsupp_shift; - manager->preproc_num++; + for (i = 0; i < item->preproc_ops_num - notsupp_shift; i++) + { + request->steps[i].type = item->preproc_ops[i + notsupp_shift].type; + request->steps[i].params = zbx_strdup(NULL, item->preproc_ops[i + notsupp_shift].params); + request->steps[i].error_handler = item->preproc_ops[i + notsupp_shift].error_handler; + request->steps[i].error_handler_params = zbx_strdup(NULL, + item->preproc_ops[i + notsupp_shift].error_handler_params); + } + + manager->preproc_num++; + } + else + request->state = REQUEST_STATE_DONE; } /* priority items are enqueued at the beginning of the line */ |