mirror of https://github.com/MISP/MISP
Serious bug with the discussion boards
- A malformed [Thread][/Thread] tag can lead to an infinite loop on the event / thread view. Fixed.pull/217/head
parent
cbcd7ac625
commit
6e842da5bc
|
@ -16,14 +16,16 @@ App::uses('AppHelper', 'View/Helper');
|
|||
}
|
||||
}
|
||||
$matches = array();
|
||||
|
||||
while (preg_match ('%\[thread\](.*?)\[/thread\]%is', $string, $matches)) {
|
||||
if (!empty($matches) && is_numeric($matches[1])) {
|
||||
$string = preg_replace('%\[thread\]' . $matches[1] . '\[/thread\]%i', '<a href=/threads/view/' . $matches[1] . '> Thread ' . $matches[1] . '</a>', $string);
|
||||
} else {
|
||||
$string = preg_replace('%\[event\]' . $matches[1] . '\[/event\]%i', '%Malformed_Thread_Link%', $string);
|
||||
$string = preg_replace('%\[thread\]' . $matches[1] . '\[/thread\]%i', '%Malformed_Thread_Link%', $string);
|
||||
}
|
||||
$matches = array();
|
||||
}
|
||||
|
||||
return $string;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue