<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>2721</bug_id>
          
          <creation_ts>2006-01-16 23:11:35 +0000</creation_ts>
          <short_desc>checklink call without protection against metacharacters</short_desc>
          <delta_ts>2008-11-18 15:18:26 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>LogValidator</product>
          <component>Modules</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>FreeBSD</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Slaven Rezic">srezic</reporter>
          <assigned_to name="Olivier Thereaux">ot</assigned_to>
          
          
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>7855</commentid>
    <comment_count>0</comment_count>
    <who name="Slaven Rezic">srezic</who>
    <bug_when>2006-01-16 23:11:35 +0000</bug_when>
    <thetext>The checklink call in W3C/LogValidator/LinkChecker.pm
        open(LINK, &quot;$checklink $uri 2&gt;/dev/null |&quot;);
seems dangerous to me. There&apos;s no protection against shell metacharacters in $uri.
It&apos;s better to use the &quot;safe pipe&quot; technique, see this patch:

#### Patch data follows ####
diff -up &apos;../build/W3C-LogValidator-1.04/lib/W3C/LogValidator/LinkChecker.pm&apos;
&apos;W3C-LogValidator-1.04/lib/W3C/LogValidator/LinkChecker.pm&apos;
Index: ./lib/W3C/LogValidator/LinkChecker.pm
Prereq:  1.5 
--- ./lib/W3C/LogValidator/LinkChecker.pm	Sun Jan 15 20:39:38 2006
+++ ./lib/W3C/LogValidator/LinkChecker.pm	Tue Jan 17 00:06:25 2006
@@ -156,7 +156,13 @@ sub process_list
 		print &quot;	processing #$total_census $uri...&quot; if ($verbose &gt; 1);
 
         # FIXME at some point we will use the library instead of running the script
-        open(LINK, &quot;$checklink $uri 2&gt;/dev/null |&quot;);
+        #open(LINK, &quot;$checklink $uri 2&gt;/dev/null |&quot;);
+		open LINK, &quot;-|&quot; or do {
+			require File::Spec;
+			open STDERR, &quot;&gt; &quot; . File::Spec-&gt;devnull or die $!;
+			exec $checklink, $uri;
+			die &quot;Can&apos;t execute $checklink: $!&quot;;
+		};
         my $num_errs = 0;
         print &quot;\n&quot; if ($verbose &gt; 2);
         while (&lt;LINK&gt;) {
#### End of Patch data ####</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>22464</commentid>
    <comment_count>1</comment_count>
    <who name="Olivier Thereaux">ot</who>
    <bug_when>2008-11-18 15:18:26 +0000</bug_when>
    <thetext>This patch was applied a long time ago, but I forgot to close the bugzilla. Thanks again to Slaven for the catch and the patch.

http://dev.w3.org/cvsweb/perl/modules/W3C/LogValidator/lib/W3C/LogValidator/LinkChecker.pm
</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>