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

Side by Side Diff: webrtc/p2p/base/pseudotcp.cc

Issue 2083723002: Fix header size check in PseudoTcp::parse(). (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@52
Patch Set: Created 4 years, 6 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 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 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 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 if (len > 0) { 566 if (len > 0) {
567 m_lastsend = now; 567 m_lastsend = now;
568 } 568 }
569 m_lasttraffic = now; 569 m_lasttraffic = now;
570 m_bOutgoing = true; 570 m_bOutgoing = true;
571 571
572 return IPseudoTcpNotify::WR_SUCCESS; 572 return IPseudoTcpNotify::WR_SUCCESS;
573 } 573 }
574 574
575 bool PseudoTcp::parse(const uint8_t* buffer, uint32_t size) { 575 bool PseudoTcp::parse(const uint8_t* buffer, uint32_t size) {
576 if (size < 12) 576 if (size < HEADER_SIZE)
577 return false; 577 return false;
578 578
579 Segment seg; 579 Segment seg;
580 seg.conv = bytes_to_long(buffer); 580 seg.conv = bytes_to_long(buffer);
581 seg.seq = bytes_to_long(buffer + 4); 581 seg.seq = bytes_to_long(buffer + 4);
582 seg.ack = bytes_to_long(buffer + 8); 582 seg.ack = bytes_to_long(buffer + 8);
583 seg.flags = buffer[13]; 583 seg.flags = buffer[13];
584 seg.wnd = bytes_to_short(buffer + 14); 584 seg.wnd = bytes_to_short(buffer + 14);
585 585
586 seg.tsval = bytes_to_long(buffer + 16); 586 seg.tsval = bytes_to_long(buffer + 16);
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after
1277 m_rbuf_len = new_size; 1277 m_rbuf_len = new_size;
1278 m_rwnd_scale = scale_factor; 1278 m_rwnd_scale = scale_factor;
1279 m_ssthresh = new_size; 1279 m_ssthresh = new_size;
1280 1280
1281 size_t available_space = 0; 1281 size_t available_space = 0;
1282 m_rbuf.GetWriteRemaining(&available_space); 1282 m_rbuf.GetWriteRemaining(&available_space);
1283 m_rcv_wnd = static_cast<uint32_t>(available_space); 1283 m_rcv_wnd = static_cast<uint32_t>(available_space);
1284 } 1284 }
1285 1285
1286 } // namespace cricket 1286 } // 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