Limit /words to 50.

This commit is contained in:
Ceda EI 2018-12-13 22:14:54 +05:30
parent 7879cf91b0
commit 0043c8ab02
1 changed files with 4 additions and 0 deletions

View File

@ -155,6 +155,10 @@ function rand_words($onewordmode) {
$num++; $num++;
$words = array(); $words = array();
if (is_integer($num)) { if (is_integer($num)) {
if ($num > 50) {
send_text("Too many words.", true);
return;
}
$wordlist = file("/usr/share/dict/words"); $wordlist = file("/usr/share/dict/words");
for ($word=1; $word < $num; $word++) { for ($word=1; $word < $num; $word++) {
$words[] = $wordlist[rand(0,count($wordlist))]; $words[] = $wordlist[rand(0,count($wordlist))];