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

Side by Side Diff: webrtc/media/sctp/sctpdataengine.cc

Issue 2318653003: Fixing stack buffer overflow (read) in SctpDataEngine. (Closed)
Patch Set: Getting rid of unneeded cast. Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 sock_, reinterpret_cast<sockaddr *>(&remote_sconn), sizeof(remote_sconn)); 543 sock_, reinterpret_cast<sockaddr *>(&remote_sconn), sizeof(remote_sconn));
544 if (connect_result < 0 && errno != SCTP_EINPROGRESS) { 544 if (connect_result < 0 && errno != SCTP_EINPROGRESS) {
545 LOG_ERRNO(LS_ERROR) << debug_name_ << "Failed usrsctp_connect. got errno=" 545 LOG_ERRNO(LS_ERROR) << debug_name_ << "Failed usrsctp_connect. got errno="
546 << errno << ", but wanted " << SCTP_EINPROGRESS; 546 << errno << ", but wanted " << SCTP_EINPROGRESS;
547 CloseSctpSocket(); 547 CloseSctpSocket();
548 return false; 548 return false;
549 } 549 }
550 // Set the MTU and disable MTU discovery. 550 // Set the MTU and disable MTU discovery.
551 // We can only do this after usrsctp_connect or it has no effect. 551 // We can only do this after usrsctp_connect or it has no effect.
552 sctp_paddrparams params = {{0}}; 552 sctp_paddrparams params = {{0}};
553 memcpy(reinterpret_cast<sockaddr*>(&params.spp_address), 553 memcpy(&params.spp_address, &remote_sconn, sizeof(remote_sconn));
554 reinterpret_cast<sockaddr*>(&remote_sconn), sizeof(sockaddr));
555 params.spp_flags = SPP_PMTUD_DISABLE; 554 params.spp_flags = SPP_PMTUD_DISABLE;
556 params.spp_pathmtu = kSctpMtu; 555 params.spp_pathmtu = kSctpMtu;
557 if (usrsctp_setsockopt(sock_, IPPROTO_SCTP, SCTP_PEER_ADDR_PARAMS, &params, 556 if (usrsctp_setsockopt(sock_, IPPROTO_SCTP, SCTP_PEER_ADDR_PARAMS, &params,
558 sizeof(params))) { 557 sizeof(params))) {
559 LOG_ERRNO(LS_ERROR) << debug_name_ 558 LOG_ERRNO(LS_ERROR) << debug_name_
560 << "Failed to set SCTP_PEER_ADDR_PARAMS."; 559 << "Failed to set SCTP_PEER_ADDR_PARAMS.";
561 } 560 }
562 return true; 561 return true;
563 } 562 }
564 563
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
1058 } 1057 }
1059 case MSG_SCTPOUTBOUNDPACKET: { 1058 case MSG_SCTPOUTBOUNDPACKET: {
1060 std::unique_ptr<OutboundPacketMessage> pdata( 1059 std::unique_ptr<OutboundPacketMessage> pdata(
1061 static_cast<OutboundPacketMessage*>(msg->pdata)); 1060 static_cast<OutboundPacketMessage*>(msg->pdata));
1062 OnPacketFromSctpToNetwork(pdata->data().get()); 1061 OnPacketFromSctpToNetwork(pdata->data().get());
1063 break; 1062 break;
1064 } 1063 }
1065 } 1064 }
1066 } 1065 }
1067 } // namespace cricket 1066 } // namespace cricket
OLDNEW
« 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