Tags:
create new tag
view all tags

Bug:

from - http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=152515

For upstream. This may be fixed, but I can't make any sense of their bugtracking system.

If one searches for, for example, "---++ " then when this is passed to grep inside Search.pm, it turns into an option. Using "-e" prevents this:

    if( $theScope eq "topic" ) {
        $cmd = "$TWiki::lsCmd *.txt | %GREP% %SWITCHES% -e $TWiki::cmdQuote$theSearchVal$TWiki::cmdQuote";
    } else {
        $cmd = "%GREP% %SWITCHES% -l -e $TWiki::cmdQuote$theSearchVal$TWiki::cmdQuote *.txt";
    }

There may be a better way.

I'd have to think a bit, and trace the code, to decide if one can pervert this or the unmodified version to execute arbitrary code on the system. (Inserting backticks or unmatched quotes or semicolons, etc.)

Test case

Patch

--- lib/TWiki/Search.pm.orig    2003-09-15 06:39:07.000000000 +1000
+++ lib/TWiki/Search.pm 2003-09-15 06:39:51.000000000 +1000
@@ -210,9 +210,9 @@
     # locales if needed, for case-insensitive searching.
     my $cmd = "";
     if( $theScope eq "topic" ) {
-        $cmd = "$TWiki::lsCmd %FILES% | %GREP% %SWITCHES% $TWiki::cmdQuote%TOKEN%$TWiki::cmdQuote";
+        $cmd = "$TWiki::lsCmd %FILES% | %GREP% %SWITCHES% -e  $TWiki::cmdQuote%TOKEN%$TWiki::cmdQuote";
     } else {
-        $cmd = "%GREP% %SWITCHES% -l $TWiki::cmdQuote%TOKEN%$TWiki::cmdQuote %FILES%";
+        $cmd = "%GREP% %SWITCHES% -l -e $TWiki::cmdQuote%TOKEN%$TWiki::cmdQuote %FILES%";
     }
 
     if( $caseSensitive ) {

Environment

TWiki version: TWikiRelease01Dec2001
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: debian
Web server: apache
Perl version:  
Client OS:  
Web Browser:  

-- SvenDowideit - 14 Sep 2003

Follow up

this is obviously resolved in TWikiRelease01Feb2003 using grep --

sorry, brainfart inprogress smile

-- SvenDowideit - 14 Sep 2003

No problem, better to double check. This is a duplicate of the SearchFailsIfStartedWithDash fix.

-- PeterThoeny - 14 Sep 2003

Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2003-09-14 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.