r11327 - /man-cgi/man.cgi
Author: jfs
Date: Mon Jan 23 21:05:00 2017
New Revision: 11327
URL: http://svn.debian.org/wsvn/?sc=1&rev=11327
Log:
Prevent empty apropos queries from taking place
Modified:
man-cgi/man.cgi
Modified: man-cgi/man.cgi
URL: http://svn.debian.org/wsvn/man-cgi/man.cgi?rev=11327&op=diff
==============================================================================
--- man-cgi/man.cgi (original)
+++ man-cgi/man.cgi Mon Jan 23 21:05:00 2017
@@ -412,7 +412,7 @@
if (!$apropos && $name =~ m/^(.*)\(([^\)]*)\)/) {
$name = $1; $section = $2;
}
- $apropos ? &apropos($query) : &man($name, $section);
+ $apropos ? &apropos($name, $alttitle) : &man($name, $section);
}
# --------------------- support routines ------------------------
@@ -491,10 +491,12 @@
}
sub apropos ($){
- local($query) = @_;
+ local($query, $alttitle) = @_;
local($_, $title, $head, *APROPOS);
local($names, $section, $msg, $key);
local($prefix);
+
+ print "DEBUG: Apropos query for $query\n x" if $debug;
if ($cache) {
CGI::Cache::start() or exit;
@@ -510,11 +512,18 @@
$head = &encode_data($query);
}
- print header (type=>'text/html',
- -expires=>'+3h');
+ &http_header("text/html", "+3h");
print &html_header("Apropos $title");
print "<H1>$www{'head'}</H1>\n\n";
&formquery;
+
+ # Prevent empty queries
+ if (!$query) {
+ print "Sorry, cannot make empty apropos queries.\n";
+ print "</DL>\n";
+ print &html_footer();
+ return;
+ }
local($mpath) = $manPath{$manpath};
Reply to: