]> git.ipfire.org Git - people/stevee/ipfire-2.x.git/commitdiff
wireguard.cgi: Fail if we are trying to edit a peer that does not exist
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 26 Apr 2025 11:05:18 +0000 (13:05 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 26 Apr 2025 11:05:18 +0000 (13:05 +0200)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
html/cgi-bin/wireguard.cgi

index 6213fd342a19c1796c73fa37f79ec046c970d6be..cb70ce30b29f0d9a339cbb5dd2401b86b5310564 100644 (file)
@@ -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'});