Bug 1025343: fix issues with overlong codec names in AudioConduit r=pkerr

This commit is contained in:
Randell Jesup 2014-06-16 01:00:33 -04:00
parent f398cfeee3
commit 06a8193337

View File

@ -853,15 +853,15 @@ 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;