From 8dc905b10509344362ee4a686653598a50662cba Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Mon, 16 Mar 2026 01:20:36 +0100 Subject: [PATCH] =?utf8?q?fix(ocpp16):=20reject=20float=20values=20for=20i?= =?utf8?q?nteger=20configuration=20keys=20per=20spec=20=C2=A75.3?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Replace convertToInt (parseInt — silently truncates 3.7 to 3) with Number.isInteger check. The spec §9.1 defines these keys as Type: integer, and §5.3 requires Rejected for values that do not conform to the expected format. --- src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts index 6a188dff..a530bc27 100644 --- a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts @@ -743,8 +743,8 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { OCPP16StandardParametersKey.WebSocketPingInterval, ]) if (integerKeys.has(keyToChange.key as OCPP16StandardParametersKey)) { - const numValue = convertToInt(value) - if (isNaN(numValue) || numValue < 0) { + const numValue = Number(value) + if (!Number.isInteger(numValue) || numValue < 0) { return OCPP16Constants.OCPP_CONFIGURATION_RESPONSE_REJECTED } } -- 2.53.0