Commit a9d0ab74 authored by JP Dinger's avatar JP Dinger

Replace for() (rand() & 0xff) with vlc_rand_bytes(); in RTMP handshake.

parent a7b45ce8
...@@ -15,9 +15,9 @@ ...@@ -15,9 +15,9 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License along
* along with this program; if not, write to the Free Software * with this program; if not, write to the Free Software Foundation, Inc.,
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/ *****************************************************************************/
/***************************************************************************** /*****************************************************************************
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <vlc_network.h> /* DOWN: #include <network.h> */ #include <vlc_network.h> /* DOWN: #include <network.h> */
#include <vlc_url.h> #include <vlc_url.h>
#include <vlc_block.h> #include <vlc_block.h>
#include <vlc_rand.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>
...@@ -338,18 +339,14 @@ rtmp_handshake_active( vlc_object_t *p_this, int fd ) ...@@ -338,18 +339,14 @@ rtmp_handshake_active( vlc_object_t *p_this, int fd )
int i; int i;
p_write[0] = RTMP_HANDSHAKE; p_write[0] = RTMP_HANDSHAKE;
for( i = 0; i < RTMP_HANDSHAKE_BODY_SIZE; i++ )
{ for( i = 0; i < 8; i++ )
if (i < 8)
{
p_write[i + 1] = 0x00; p_write[i + 1] = 0x00;
} else {
p_write[i + 1] = rand() & 0xFF; vlc_rand_bytes( p_write+1+8, RTMP_HANDSHAKE_BODY_SIZE-8 );
}
}
/* Send handshake*/ /* Send handshake*/
i_ret = net_Write( p_this, fd, NULL, p_write, RTMP_HANDSHAKE_BODY_SIZE + 1 ); i_ret = net_Write( p_this, fd, NULL, p_write, RTMP_HANDSHAKE_BODY_SIZE+1 );
if( i_ret != RTMP_HANDSHAKE_BODY_SIZE + 1 ) if( i_ret != RTMP_HANDSHAKE_BODY_SIZE + 1 )
{ {
msg_Err( p_this, "failed to send handshake" ); msg_Err( p_this, "failed to send handshake" );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment