From 2f7440a49ba7e99b6d4f063eb7fe8069677fb863 Mon Sep 17 00:00:00 2001 From: Matheus Buschermoehle Date: Wed, 27 Nov 2024 22:02:56 -0300 Subject: [PATCH] refactor: add method that validate framelen non negative --- cli/src/main/java/hudson/cli/PlainCLIProtocol.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cli/src/main/java/hudson/cli/PlainCLIProtocol.java b/cli/src/main/java/hudson/cli/PlainCLIProtocol.java index 11a8c7266340..1737e231206c 100644 --- a/cli/src/main/java/hudson/cli/PlainCLIProtocol.java +++ b/cli/src/main/java/hudson/cli/PlainCLIProtocol.java @@ -125,9 +125,7 @@ public void run() { try { while (true) { int framelen = readFrameLength(); - if (framelen < 0) { - throw new IOException("corrupt stream: negative frame length"); - } + validateFrameLength(framelen); processFrame(framelen); } } catch (IOException | RuntimeException x) {