From ef1e2616f150673b766b580d8a3d542cb6084dac Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Wed, 23 Sep 2020 09:38:46 +0100 Subject: [PATCH] #738 crash on wildcard search --- lib/App/Netdisco/Web/Plugin/Search/Node.pm | 1 + lib/App/Netdisco/Web/Plugin/Search/VLAN.pm | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/App/Netdisco/Web/Plugin/Search/Node.pm b/lib/App/Netdisco/Web/Plugin/Search/Node.pm index 0b4995e7..adfd00d4 100644 --- a/lib/App/Netdisco/Web/Plugin/Search/Node.pm +++ b/lib/App/Netdisco/Web/Plugin/Search/Node.pm @@ -63,6 +63,7 @@ register_search_tab({ get '/ajax/content/search/node' => require_login sub { my $node = param('q'); send_error('Missing node', 400) unless $node; + return unless ($node =~ m/\w/); # need some alphanum at least content_type('text/html'); my $agenot = param('age_invert') || '0'; diff --git a/lib/App/Netdisco/Web/Plugin/Search/VLAN.pm b/lib/App/Netdisco/Web/Plugin/Search/VLAN.pm index ac7f6aa4..1fa520b5 100644 --- a/lib/App/Netdisco/Web/Plugin/Search/VLAN.pm +++ b/lib/App/Netdisco/Web/Plugin/Search/VLAN.pm @@ -23,6 +23,7 @@ register_search_tab({ get '/ajax/content/search/vlan' => require_login sub { my $q = param('q'); send_error( 'Missing query', 400 ) unless $q; + return unless ($q =~ m/\w/); # need some alphanum at least my $rs; if ( $q =~ m/^\d+$/ ) {