ensure that the flag field is formatted as CCTF{...}, otherwise treat it as invalid

main
SI 2024-04-04 02:16:55 +02:00
parent c186f2b318
commit 0a7fca68dd
1 changed files with 2 additions and 0 deletions

View File

@ -27,6 +27,8 @@
var s = inpFlag.value; var s = inpFlag.value;
var k = new BN(0); var k = new BN(0);
var h = "0x"; var h = "0x";
if (s.slice(0, 5) !== "CCTF{" || s.slice(-1) !== "}")
return null;
for (i in s) { for (i in s) {
var c = s.charCodeAt(i); var c = s.charCodeAt(i);
k = k.muln(16).addn(c); k = k.muln(16).addn(c);