luci-proto-wireguard: verify last base64 string symbol is an = sign

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
This commit is contained in:
Florian Eckert 2020-05-12 14:45:47 +02:00
parent 59bc317326
commit dae15b8cf4

View file

@ -10,6 +10,9 @@ function validateBase64(section_id, value) {
if (value.length != 44 || !value.match(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/))
return _('Invalid Base64 key string');
if (value[43] != "=" )
return _('Invalid Base64 key string');
return true;
}