Added a security check to the server.js
This commit is contained in:
parent
b0bfcf6c27
commit
3924cbaa84
@ -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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user