Skip to content

Commit

Permalink
fixup potential security hole
Browse files Browse the repository at this point in the history
  • Loading branch information
wkpark committed May 5, 2015
1 parent f697f98 commit c805dfa
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion plugin/processor/mimetex.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,15 @@ function processor_mimetex($formatter,$value) {
$mimetex = str_replace ('shell:', '', $mimetex);

$uniq = md5($tex);
$tex = escapeshellarg($tex);

if ( ! file_exists ($cache_dir) ) {
umask (000);
mkdir ($cache_dir, 0777);
}

if ( $formatter->preview || $formatter->refresh || ! file_exists ("$cache_dir/$uniq.$ext")) {
$cmd = "$mimetex -e $cache_dir/$uniq.$ext \"$tex\"";
$cmd = "$mimetex -e $cache_dir/$uniq.$ext $tex";
$fp = @popen ($cmd.$formatter->NULL, 'r');
if ( ! is_resource ($fp) ) return $tex;
pclose ($fp);
Expand Down

0 comments on commit c805dfa

Please sign in to comment.