forked from mirror/openwrt
wireguard-tools: fix string indexing in endpoint host check
Use substr() instead of array index syntax to access the first
character of the endpoint host string, as ucode does not support
array-style indexing on strings.
Fixes: https://github.com/openwrt/openwrt/issues/22116
Fixes: 8f977b4a40 ("wireguard-tools: fix handling of multi-value config options")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
parent
e95cfd2ad7
commit
2256cfac68
1 changed files with 1 additions and 1 deletions
|
|
@ -123,7 +123,7 @@ function proto_setup(proto) {
|
|||
|
||||
if (peer.endpoint_host) {
|
||||
let eph = peer.endpoint_host;
|
||||
if (index(eph, ':') >= 0 && eph[0] != '[')
|
||||
if (index(eph, ':') >= 0 && substr(eph, 0, 1) != '[')
|
||||
eph = sprintf('[%s]', eph);
|
||||
wg_config += sprintf('Endpoint=%s:%s\n', eph, peer.endpoint_port);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue