1
0

Added a security check to the server.js

This commit is contained in:
Mathias Wagner 2023-11-19 01:47:42 +01:00
parent b0bfcf6c27
commit 3924cbaa84
Signed by: Mathias
GPG Key ID: B8DC354B0A1F5B44

View File

@ -87,6 +87,19 @@ io.on("connection", (socket) => {
return; return;
} }
try {
const priceInt = parseInt(price);
const amountInt = parseInt(amount);
if (isNaN(priceInt) || isNaN(amountInt)) {
callback(false);
return;
}
} catch (e) {
callback(false);
return;
}
if (price < 0 || price > 10000 || amount < 0 || amount > 20) { if (price < 0 || price > 10000 || amount < 0 || amount > 20) {
callback(false); callback(false);
return; return;