From 0bdbbd0e323062eab81504f61affc985e2c44cae Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Sat, 26 Apr 2025 13:05:18 +0200 Subject: [PATCH] wireguard.cgi: Fail if we are trying to edit a peer that does not exist Signed-off-by: Michael Tremer --- html/cgi-bin/wireguard.cgi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/html/cgi-bin/wireguard.cgi b/html/cgi-bin/wireguard.cgi index 6213fd342..cb70ce30b 100644 --- a/html/cgi-bin/wireguard.cgi +++ b/html/cgi-bin/wireguard.cgi @@ -334,6 +334,11 @@ END # Load the existing peer my $peer = &Wireguard::load_peer($key); + # Fail if we don't have the key + unless (defined $peer) { + die "Peer $key does not exist\n"; + } + # Check if the name is valid unless (&Wireguard::name_is_valid($cgiparams{"NAME"})) { push(@errormessages, $Lang::tr{'wg invalid name'}); -- 2.39.5