Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4084)

Unified Diff: base/sync_socket_win.cc

Issue 1357023005: Use RandBytes instead of rand_s for pipe names. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/sync_socket_win.cc
diff --git a/base/sync_socket_win.cc b/base/sync_socket_win.cc
index e5088162433f2f402a8809c1342142c028e07341..e16b925bbdf000299566bab887f4235b95f652b5 100644
--- a/base/sync_socket_win.cc
+++ b/base/sync_socket_win.cc
@@ -5,6 +5,7 @@
#include "base/sync_socket.h"
#include "base/logging.h"
+#include "base/rand_util.h"
#include "base/threading/thread_restrictions.h"
#include "base/win/scoped_handle.h"
@@ -39,9 +40,8 @@ bool CreatePairImpl(HANDLE* socket_a, HANDLE* socket_b, bool overlapped) {
flags |= FILE_FLAG_OVERLAPPED;
do {
- unsigned int rnd_name;
- if (rand_s(&rnd_name) != 0)
- return false;
+ unsigned long rnd_name;
+ RandBytes(&rnd_name, sizeof(rnd_name));
swprintf(name, kPipePathMax,
kPipeNameFormat,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698