Bug 1025343: fix issues with overlong codec names in AudioConduit r=pkerr
authorRandell Jesup <rjesup@jesup.org>
Mon, 16 Jun 2014 01:00:33 -0400
changeset 188866 8c3f99209da5af4fa2b0c722b7021263c942411f
parent 188865 60cbb07392c39b181e26235aa8e716f583f86d0d
child 188867 d591d9ed638b51eed04e1719b6479df9fe1db150
push id26970
push userryanvm@gmail.com
push dateMon, 16 Jun 2014 18:49:07 +0000
treeherdermozilla-central@f19ca5123d6a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspkerr
bugs1025343
milestone33.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1025343: fix issues with overlong codec names in AudioConduit r=pkerr
media/webrtc/signaling/src/media-conduit/AudioConduit.cpp
--- a/media/webrtc/signaling/src/media-conduit/AudioConduit.cpp
+++ b/media/webrtc/signaling/src/media-conduit/AudioConduit.cpp
@@ -848,25 +848,25 @@ int WebrtcAudioConduit::SendRTCPPacket(i
 /**
  * Converts between CodecConfig to WebRTC Codec Structure.
  */
 
 bool
 WebrtcAudioConduit::CodecConfigToWebRTCCodec(const AudioCodecConfig* codecInfo,
                                               webrtc::CodecInst& cinst)
  {
-  const unsigned int plNameLength = codecInfo->mName.length()+1;
+  const unsigned int plNameLength = codecInfo->mName.length();
   memset(&cinst, 0, sizeof(webrtc::CodecInst));
-  if(sizeof(cinst.plname) < plNameLength)
+  if(sizeof(cinst.plname) < plNameLength+1)
   {
     CSFLogError(logTag, "%s Payload name buffer capacity mismatch ",
                                                       __FUNCTION__);
     return false;
   }
-  memcpy(cinst.plname, codecInfo->mName.c_str(),codecInfo->mName.length());
+  memcpy(cinst.plname, codecInfo->mName.c_str(), plNameLength);
   cinst.plname[plNameLength]='\0';
   cinst.pltype   =  codecInfo->mType;
   cinst.rate     =  codecInfo->mRate;
   cinst.pacsize  =  codecInfo->mPacSize;
   cinst.plfreq   =  codecInfo->mFreq;
   cinst.channels =  codecInfo->mChannels;
   return true;
  }