]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki.pm
ikiwiki-mass-rebuild: Fix tty hijacking vulnerability by using su. (Once su's related...
[git.ikiwiki.info.git] / IkiWiki.pm
index ea44081aa25f33c693d0c82b19bc081a38fbfa9d..443c7044796a29947936fd5de57e8e09c14bfec4 100644 (file)
@@ -334,6 +334,10 @@ sub readfile ($;$$) { #{{{
        binmode($in) if ($binary);
        return \*$in if $wantfd;
        my $ret=<$in>;
+       # check for invalid utf-8, and toss it back to avoid crashes
+       if (! utf8::valid($ret)) {
+               $ret=encode_utf8($ret);
+       }
        close $in || error("failed to read $file: $!");
        return $ret;
 } #}}}
@@ -564,7 +568,7 @@ sub urlto ($$;$) { #{{{
        }
 
        if ($absolute) {
-               return $config{url}.beautify_urlpath("/".$to);
+               return $config{url}.beautify_url("/".$to);
        }
 
        my $link = abs2rel($to, dirname(htmlpage($from)));