Improve randomness of RTSP session ID.
authorRémi Denis-Courmont <rem@videolan.org>
Sat, 1 Sep 2007 17:34:39 +0000 (17:34 +0000)
committerRémi Denis-Courmont <rem@videolan.org>
Sat, 1 Sep 2007 17:34:39 +0000 (17:34 +0000)
Now it should not be possible to guess other people's ID.

modules/stream_out/rtsp.c

index 0979fff..a09e674 100644 (file)
@@ -32,6 +32,7 @@
 #include <vlc_httpd.h>
 #include <vlc_url.h>
 #include <vlc_network.h>
 #include <vlc_httpd.h>
 #include <vlc_url.h>
 #include <vlc_network.h>
+#include <vlc_rand.h>
 #include <assert.h>
 #include <errno.h>
 #include <stdlib.h>
 #include <assert.h>
 #include <errno.h>
 #include <stdlib.h>
@@ -248,7 +249,7 @@ rtsp_session_t *RtspClientNew( rtsp_stream_t *rtsp )
         return NULL;
 
     s->stream = rtsp;
         return NULL;
 
     s->stream = rtsp;
-    s->id = rand(); /* FIXME: not enough entropy */
+    vlc_rand_bytes (&s->id, sizeof (s->id));
     s->trackc = 0;
     s->trackv = NULL;
 
     s->trackc = 0;
     s->trackv = NULL;