]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Fix for bug 57821 - Empty regular expression causes a software error.
authorjake%acutex.net <>
Sat, 6 Oct 2001 06:06:08 +0000 (06:06 +0000)
committerjake%acutex.net <>
Sat, 6 Oct 2001 06:06:08 +0000 (06:06 +0000)
Patch by Nick Hibma <n_hibma@qubesoft.com>
r= jake@acutex.net

editusers.cgi

index 48dcfa0c1a22c414e74ee2a053ac80feb0f93d7a..b1c1d01d624b338655f7c5de90fb7fbef7de511f 100755 (executable)
@@ -292,20 +292,25 @@ List users with login name matching:
 if ($action eq 'list') {
     PutHeader("Select user");
     my $query = "";
+    my $matchstr = $::FORM{'matchstr'};
     if (exists $::FORM{'matchtype'}) {
       $query = "SELECT login_name,realname,disabledtext " .
           "FROM profiles WHERE login_name ";
       if ($::FORM{'matchtype'} eq 'substr') {
           $query .= "like";
-          $::FORM{'matchstr'} = '%' . $::FORM{'matchstr'} . '%';
+          $matchstr = '%' . $matchstr . '%';
       } elsif ($::FORM{'matchtype'} eq 'regexp') {
           $query .= "regexp";
+          $matchstr = '.'
+               unless $matchstr;
       } elsif ($::FORM{'matchtype'} eq 'notregexp') {
           $query .= "not regexp";
+          $matchstr = '.'
+               unless $matchstr;
       } else {
           die "Unknown match type";
       }
-      $query .= SqlQuote($::FORM{'matchstr'}) . " ORDER BY login_name";
+      $query .= SqlQuote($matchstr) . " ORDER BY login_name";
     } elsif (exists $::FORM{'query'}) {
       $query = "SELECT login_name,realname,disabledtext " .
           "FROM profiles WHERE " . $::FORM{'query'} . " ORDER BY login_name";