diff --git a/Changelog b/Changelog index 575eec206..acdcf0103 100755 --- a/Changelog +++ b/Changelog @@ -1,4 +1,5 @@ 2018-01-16 DariusIII + * Chg: Add check for openssl_pseudo_bytes IV generation * Fix: Fix getCBPTableNames function calls * Fix: Fix call to Releases * Chg: Use Group model and remove nntmux\Groups class diff --git a/nntmux/Binaries.php b/nntmux/Binaries.php index 35a7fd8f8..92efcb25b 100755 --- a/nntmux/Binaries.php +++ b/nntmux/Binaries.php @@ -399,7 +399,7 @@ class Binaries // We will use this to subtract so we leave articles for the next time (in case the server doesn't have them yet) $leaveOver = $this->messageBuffer; - // If this is not a new group, go from our newest to the servers newest. + // If this is not a new group, go from our newest to the servers newest. } else { // Set our oldest wanted to our newest local article. $first = $groupMySQL['last_record']; @@ -890,6 +890,12 @@ class Binaries $date = $this->header['Date'] > $now ? $now : $this->header['Date']; $unixtime = is_numeric($this->header['Date']) ? $date : $now; + $random = openssl_random_pseudo_bytes(16, $isSourceStrong); + + if ($isSourceStrong === false || $random === false) { + throw new \RuntimeException('IV generation failed'); + } + $collectionID = $this->_pdo->queryInsert( sprintf( " @@ -907,7 +913,7 @@ class Binaries sha1($this->header['CollectionKey']), $collMatch['id'], $xref, - bin2hex(openssl_random_pseudo_bytes(16)) + bin2hex($random) ) );