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

Unified Diff: native_client_sdk/src/libraries/nacl_io/socket/socket_node.cc

Issue 176923017: [NaCl SDK] Compile for naclio for Bionic (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix bug in h_error Created 6 years, 9 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
Index: native_client_sdk/src/libraries/nacl_io/socket/socket_node.cc
diff --git a/native_client_sdk/src/libraries/nacl_io/socket/socket_node.cc b/native_client_sdk/src/libraries/nacl_io/socket/socket_node.cc
index e296117b4836d16ed4801b34f7996e55a1f4fe9a..98de7f623f92c14186ca4dcf7d13aeadf8321d82 100644
--- a/native_client_sdk/src/libraries/nacl_io/socket/socket_node.cc
+++ b/native_client_sdk/src/libraries/nacl_io/socket/socket_node.cc
@@ -266,6 +266,8 @@ Error SocketNode::SetSockOpt(int lvl,
int optname,
const void* optval,
socklen_t len) {
+ size_t buflen = static_cast<size_t>(len);
+
if (lvl != SOL_SOCKET)
return ENOPROTOOPT;
@@ -276,14 +278,14 @@ Error SocketNode::SetSockOpt(int lvl,
// SO_REUSEADDR is effectivly always on since we can't
// disable it with PPAPI sockets. Just return success
// here regardless.
- if (len < sizeof(int))
+ if (buflen < sizeof(int))
return EINVAL;
return 0;
}
case SO_LINGER: {
// Not supported by the PPAPI interface but we preserve
// the settings and pretend to support it.
- if (len < sizeof(struct linger))
+ if (buflen < sizeof(struct linger))
return EINVAL;
struct linger new_linger = *static_cast<const linger*>(optval);
// Don't allow setting linger to be enabled until we
@@ -298,7 +300,7 @@ Error SocketNode::SetSockOpt(int lvl,
case SO_KEEPALIVE: {
// Not supported by the PPAPI interface but we preserve
// the flag and pretend to support it.
- if (len < sizeof(int))
+ if (buflen < sizeof(int))
return EINVAL;
int value = *static_cast<const int*>(optval);
keep_alive_ = value != 0;

Powered by Google App Engine
This is Rietveld 408576698