From 6c9be123ef78288e7cc9f27cd60e9932bde119b9 Mon Sep 17 00:00:00 2001 From: "niklas.enbom@webrtc.org" Date: Wed, 21 Dec 2011 08:59:31 +0000 Subject: [PATCH] Letting strncpy do its job. Landing and extending http://webrtc-codereview.appspot.com/329010/ on behalf of tbreisacher. Review URL: http://webrtc-codereview.appspot.com/335009 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1260 4adac7df-926f-26a2-2b94-8c16560cd09d --- .../rtp_rtcp/source/remote_rate_control.cc | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/modules/rtp_rtcp/source/remote_rate_control.cc b/src/modules/rtp_rtcp/source/remote_rate_control.cc index b624ee2b96..c54e8ccbdb 100644 --- a/src/modules/rtp_rtcp/source/remote_rate_control.cc +++ b/src/modules/rtp_rtcp/source/remote_rate_control.cc @@ -457,16 +457,13 @@ void RemoteRateControl::StateStr(RateControlState state, char* str) switch (state) { case kRcDecrease: - strncpy(str, "DECREASE", 8); - str[8] = 0; + strncpy(str, "DECREASE", 9); break; case kRcHold: - strncpy(str, "HOLD", 4); - str[4] = 0; + strncpy(str, "HOLD", 5); break; case kRcIncrease: - strncpy(str, "INCREASE", 8); - str[8] = 0; + strncpy(str, "INCREASE", 9); break; } } @@ -476,16 +473,13 @@ void RemoteRateControl::StateStr(BandwidthUsage state, char* str) switch (state) { case kBwNormal: - strncpy(str, "NORMAL", 6); - str[6] = 0; + strncpy(str, "NORMAL", 7); break; case kBwOverusing: - strncpy(str, "OVER USING", 10); - str[10] = 0; + strncpy(str, "OVER USING", 11); break; case kBwUnderUsing: - strncpy(str, "UNDER USING", 11); - str[11] = 0; + strncpy(str, "UNDER USING", 12); break; } }