From: Michael Tremer Date: Sat, 26 Apr 2025 11:05:18 +0000 (+0200) Subject: wireguard.cgi: Fail if we are trying to edit a peer that does not exist X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0bdbbd0e323062eab81504f61affc985e2c44cae;p=people%2Fstevee%2Fipfire-2.x.git wireguard.cgi: Fail if we are trying to edit a peer that does not exist Signed-off-by: Michael Tremer --- 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'});