From 458c085ac2d9a8a7a603ac4f6ed94332aa64b9f6 Mon Sep 17 00:00:00 2001 From: ZhuangYumin Date: Mon, 18 Dec 2023 01:34:21 +0000 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E5=AF=B9token?= =?UTF-8?q?=E6=95=B0=E4=B8=8D=E6=AD=A3=E7=A1=AE=E7=9A=84=E5=8E=9F=E5=A7=8B?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E7=9A=84=E6=8B=A6=E6=88=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/Web/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/frontend/Web/index.js b/frontend/Web/index.js index 18dfdff..23ed90c 100644 --- a/frontend/Web/index.js +++ b/frontend/Web/index.js @@ -140,6 +140,12 @@ io.on('connection', async (socket) => { } } const substrings = msg.trim().split('\n')[0].split(' '); + if(substrings.length<2) + { + console.log("input has "+substrings.length+" words"); + socket.emit('response', "Invalid Input"); + return; + } const head=substrings[0]; const session_token=substrings[1]; if(head[1]=='O')