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

Issue 310903002: nacl_io: only copy up to the size of the sockaddr_in*, not the given len. (Closed)

Created:
6 years, 6 months ago by jvoung (off chromium)
Modified:
5 years, 11 months ago
Reviewers:
Sam Clegg, binji
CC:
chromium-reviews, binji+watch_chromium.org
Visibility:
Public.

Description

nacl_io: only copy up to the size of the sockaddr_in*, not the given len. One of the tests (SocketTestTCP, Listen) submits a len "addrlen = sizeof(addr) + 10", so that causes the memcpy to overwrite part of the caller's stack (because the outparam points at the stack). Related to: BUG= https://code.google.com/p/nativeclient/issues/detail?id=3867 (last time the compile change caused the test to fail) NOTRY=true (only an SDK change) Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=274689

Patch Set 1 #

Total comments: 4

Patch Set 2 : min(len, sizeof) instead #

Patch Set 3 : not depend on prev addrlen #

Patch Set 4 : test w/ bigger buffer too #

Patch Set 5 : stuff #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+37 lines, -11 lines) Patch
M native_client_sdk/src/libraries/nacl_io/socket/socket_node.cc View 1 2 chunks +6 lines, -4 lines 0 comments Download
M native_client_sdk/src/tests/nacl_io_socket_test/socket_test.cc View 1 2 3 4 1 chunk +31 lines, -7 lines 1 comment Download

Messages

Total messages: 10 (0 generated)
jvoung (off chromium)
https://codereview.chromium.org/310903002/diff/1/native_client_sdk/src/libraries/nacl_io/socket/socket_node.cc File native_client_sdk/src/libraries/nacl_io/socket/socket_node.cc (right): https://codereview.chromium.org/310903002/diff/1/native_client_sdk/src/libraries/nacl_io/socket/socket_node.cc#newcode160 native_client_sdk/src/libraries/nacl_io/socket/socket_node.cc:160: len = sizeof(addr4); Hmm, not sure of the point ...
6 years, 6 months ago (2014-06-03 19:24:23 UTC) #1
Sam Clegg
https://codereview.chromium.org/310903002/diff/1/native_client_sdk/src/libraries/nacl_io/socket/socket_node.cc File native_client_sdk/src/libraries/nacl_io/socket/socket_node.cc (right): https://codereview.chromium.org/310903002/diff/1/native_client_sdk/src/libraries/nacl_io/socket/socket_node.cc#newcode160 native_client_sdk/src/libraries/nacl_io/socket/socket_node.cc:160: len = sizeof(addr4); On 2014/06/03 19:24:23, jvoung wrote: > ...
6 years, 6 months ago (2014-06-03 19:32:43 UTC) #2
binji
https://codereview.chromium.org/310903002/diff/1/native_client_sdk/src/libraries/nacl_io/socket/socket_node.cc File native_client_sdk/src/libraries/nacl_io/socket/socket_node.cc (right): https://codereview.chromium.org/310903002/diff/1/native_client_sdk/src/libraries/nacl_io/socket/socket_node.cc#newcode160 native_client_sdk/src/libraries/nacl_io/socket/socket_node.cc:160: len = sizeof(addr4); On 2014/06/03 19:32:43, Sam Clegg wrote: ...
6 years, 6 months ago (2014-06-03 20:10:05 UTC) #3
Sam Clegg
On 2014/06/03 19:32:43, Sam Clegg wrote: > https://codereview.chromium.org/310903002/diff/1/native_client_sdk/src/libraries/nacl_io/socket/socket_node.cc > File native_client_sdk/src/libraries/nacl_io/socket/socket_node.cc (right): > > https://codereview.chromium.org/310903002/diff/1/native_client_sdk/src/libraries/nacl_io/socket/socket_node.cc#newcode160 ...
6 years, 6 months ago (2014-06-03 20:11:21 UTC) #4
jvoung (off chromium)
https://codereview.chromium.org/310903002/diff/1/native_client_sdk/src/libraries/nacl_io/socket/socket_node.cc File native_client_sdk/src/libraries/nacl_io/socket/socket_node.cc (right): https://codereview.chromium.org/310903002/diff/1/native_client_sdk/src/libraries/nacl_io/socket/socket_node.cc#newcode160 native_client_sdk/src/libraries/nacl_io/socket/socket_node.cc:160: len = sizeof(addr4); On 2014/06/03 20:10:05, binji wrote: > ...
6 years, 6 months ago (2014-06-03 21:59:32 UTC) #5
binji
lgtm
6 years, 6 months ago (2014-06-04 00:23:34 UTC) #6
jvoung (off chromium)
The CQ bit was checked by jvoung@chromium.org
6 years, 6 months ago (2014-06-04 00:42:25 UTC) #7
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/jvoung@chromium.org/310903002/60001
6 years, 6 months ago (2014-06-04 00:42:42 UTC) #8
commit-bot: I haz the power
Change committed as 274689
6 years, 6 months ago (2014-06-04 00:44:50 UTC) #9
Sam Clegg
6 years, 6 months ago (2014-06-04 00:45:28 UTC) #10
Message was sent while issue was closed.
https://codereview.chromium.org/310903002/diff/60001/native_client_sdk/src/te...
File native_client_sdk/src/tests/nacl_io_socket_test/socket_test.cc (right):

https://codereview.chromium.org/310903002/diff/60001/native_client_sdk/src/te...
native_client_sdk/src/tests/nacl_io_socket_test/socket_test.cc:655:
ASSERT_EQ(client_addr2.sin_addr.s_addr, 0);
This seems like it should be its own test really...  I can move it out in
another CL if the CQ is gonna land this version.

Powered by Google App Engine
This is Rietveld 408576698