]> jspc29.x-matter.uni-frankfurt.de Git - daqtools.git/commitdiff
Parse netaddr stricter in get.pl
authorAndreas Neiser <neiser@kph.uni-mainz.de>
Tue, 20 May 2014 13:27:31 +0000 (15:27 +0200)
committerAndreas Neiser <neiser@kph.uni-mainz.de>
Wed, 21 May 2014 13:30:09 +0000 (15:30 +0200)
xml-db/get.pl

index f4677bda62d0aa37be3120b416abd5e8fa857bd4..a5a39fb54383a7aa39fba6772a947b00ad52fa2a 100755 (executable)
@@ -94,9 +94,13 @@ foreach my $req (@request) {
 ###############################
 
   die "Entity $file not found.\n" unless(-e $file) ;
-    
-  if    ($netaddr=~ m/0x([0-9a-fA-F]{4})/) {$netaddr = hex($1);}
-  elsif ($netaddr=~ m/([0-9]{1,5})/) {$netaddr = $1;}
+
+
+  # trim whitespace from netaddr
+  $netaddr =~ s/^\s+|\s+$//g;
+
+  if    ($netaddr=~ m/^0x([0-9a-fA-F]{4})$/) {$netaddr = hex($1);}
+  elsif ($netaddr=~ m/^([0-9]{1,5})$/) {$netaddr = $1;}
   else {die "Could not parse address $netaddr\n";}