[vlc-commits] Contribs: UPnP use rand_s to generate random
Jean-Baptiste Kempf
git at videolan.org
Tue May 10 13:56:33 CEST 2016
vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Mon May 9 19:40:57 2016 +0200| [33cf212f4ae0c61849d848b0fa092a2935fbd6b1] | committer: Hugo Beauzée-Luyssen
Contribs: UPnP use rand_s to generate random
Instead of timeofday+machine_name
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=33cf212f4ae0c61849d848b0fa092a2935fbd6b1
---
contrib/src/upnp/rules.mak | 1 +
contrib/src/upnp/windows-random.patch | 34 +++++++++++++++++++++++++++++++++
2 files changed, 35 insertions(+)
diff --git a/contrib/src/upnp/rules.mak b/contrib/src/upnp/rules.mak
index dabeb6a..dc2d73d 100644
--- a/contrib/src/upnp/rules.mak
+++ b/contrib/src/upnp/rules.mak
@@ -22,6 +22,7 @@ ifdef HAVE_WIN32
$(APPLY) $(SRC)/upnp/libupnp-configure.patch
$(APPLY) $(SRC)/upnp/libupnp-win32.patch
$(APPLY) $(SRC)/upnp/libupnp-win64.patch
+ $(APPLY) $(SRC)/upnp/windows-random.patch
endif
$(APPLY) $(SRC)/upnp/libupnp-ipv6.patch
$(APPLY) $(SRC)/upnp/miniserver.patch
diff --git a/contrib/src/upnp/windows-random.patch b/contrib/src/upnp/windows-random.patch
new file mode 100644
index 0000000..f817886
--- /dev/null
+++ b/contrib/src/upnp/windows-random.patch
@@ -0,0 +1,34 @@
+diff -ruN upnp/upnp/src/uuid/sysdep.c upnp.new/upnp/src/uuid/sysdep.c
+--- upnp/upnp/src/uuid/sysdep.c 2011-04-03 04:50:36.000000000 +0200
++++ upnp.new/upnp/src/uuid/sysdep.c 2016-05-09 19:08:15.225581588 +0200
+@@ -23,6 +23,8 @@
+
+ #include "config.h"
+
++#define _CRT_RAND_S
++
+ #include "sysdep.h"
+
+ #include "UpnpInet.h"
+@@ -78,6 +80,7 @@
+
+ void get_random_info(unsigned char seed[16])
+ {
++#if 0
+ MD5_CTX c;
+ typedef struct {
+ MEMORYSTATUS m;
+@@ -108,6 +111,13 @@
+ MD5Init(&c);
+ MD5Update(&c, (unsigned char *)(&r), sizeof r);
+ MD5Final(seed, &c);
++#endif
++ for( int i = 0; i < 16; i++ )
++ {
++ unsigned int number;
++ rand_s(&number);
++ seed[i] = number;
++ }
+ };
+
+ #else /* WIN32 */
More information about the vlc-commits
mailing list