From: Florian Eckert Date: Tue, 12 May 2020 12:45:47 +0000 (+0200) Subject: luci-proto-wireguard: verify last base64 string symbol is an = sign X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=dae15b8cf476fe761b2b6a7457c4d8e3e9950569;p=oweals%2Fluci.git luci-proto-wireguard: verify last base64 string symbol is an = sign Signed-off-by: Florian Eckert --- diff --git a/protocols/luci-proto-wireguard/htdocs/luci-static/resources/protocol/wireguard.js b/protocols/luci-proto-wireguard/htdocs/luci-static/resources/protocol/wireguard.js index 49f61c782..e88c07c33 100644 --- a/protocols/luci-proto-wireguard/htdocs/luci-static/resources/protocol/wireguard.js +++ b/protocols/luci-proto-wireguard/htdocs/luci-static/resources/protocol/wireguard.js @@ -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; }