From 85005a184d4f1c3d339b7c895b5d2469f3b45171 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20=C3=81ngel?= Date: Tue, 15 Jan 2019 13:02:26 +0100 Subject: [PATCH] Fixed infinite loop (when API fails) for CSV function --- server/controllers/wazuh-api.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/controllers/wazuh-api.js b/server/controllers/wazuh-api.js index 9bac2319a0..3ce72adbe4 100644 --- a/server/controllers/wazuh-api.js +++ b/server/controllers/wazuh-api.js @@ -760,7 +760,7 @@ export class WazuhApiCtrl { params.offset = 0; const { totalItems } = output.body.data; itemsArray.push(...output.body.data.items); - while (itemsArray.length < totalItems) { + while (itemsArray.length < totalItems && params.offset < totalItems) { params.offset += params.limit; const tmpData = await needle( 'get',