]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
mdlinkcheck: reject URLs containing quotes
authorDaniel Stenberg <daniel@haxx.se>
Mon, 6 Oct 2025 14:10:27 +0000 (16:10 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 6 Oct 2025 21:38:41 +0000 (23:38 +0200)
Those would be illegal anyway and would make the script misbehave

Reported-by: Stanislav Fort
Closes #18889

scripts/mdlinkcheck

index 925edc52944a1a53138b0dd7906e8140ff260224..bbd6ac46022bd7bcaa28ae3fd46987ea06766ae1 100755 (executable)
@@ -140,6 +140,10 @@ sub checkurl {
     print "check $url\n";
     my $curlcmd="curl -ILfsm10 --retry 2 --retry-delay 5 -A \"Mozilla/curl.se link-probe\"";
     $url =~ s/\+/%2B/g;
+    if($url =~ /[\"\'\n]/) {
+        print STDERR "Bad URL in markdown: %s\n", $url{$url};
+        return 1; # fail
+    }
     my @content = `$curlcmd \"$url\"`;
     if(!$content[0]) {
         print STDERR "FAIL\n";