Added buffer length when calling encrypt(). Write the extra two bytes.
BUG=934 TEST=Run VoE Autotest Encryption with Valgrind. Review URL: https://webrtc-codereview.appspot.com/930004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@2995 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
8dde197788
commit
512535097e
@ -187,6 +187,8 @@ Channel::SendPacket(int channel, const void *data, int len)
|
||||
// Allocate memory for encryption buffer one time only
|
||||
_encryptionRTPBufferPtr =
|
||||
new WebRtc_UWord8[kVoiceEngineMaxIpPacketSizeBytes];
|
||||
memset(_encryptionRTPBufferPtr, 0,
|
||||
kVoiceEngineMaxIpPacketSizeBytes);
|
||||
}
|
||||
|
||||
// Perform encryption (SRTP or external)
|
||||
|
@ -28,6 +28,8 @@ void BasicBitInverseEncryption::encrypt(int, unsigned char* in_data,
|
||||
int i;
|
||||
for (i = 0; i < bytes_in; i++)
|
||||
out_data[i] = ~in_data[i];
|
||||
out_data[bytes_in] = 0;
|
||||
out_data[bytes_in + 1] = 0;
|
||||
*bytes_out = bytes_in + 2;
|
||||
}
|
||||
|
||||
@ -46,6 +48,8 @@ void BasicBitInverseEncryption::encrypt_rtcp(int, unsigned char* in_data,
|
||||
int i;
|
||||
for (i = 0; i < bytes_in; i++)
|
||||
out_data[i] = ~in_data[i];
|
||||
out_data[bytes_in] = 0;
|
||||
out_data[bytes_in + 1] = 0;
|
||||
*bytes_out = bytes_in + 2;
|
||||
}
|
||||
|
||||
@ -55,6 +59,8 @@ void BasicBitInverseEncryption::decrypt_rtcp(int, unsigned char* in_data,
|
||||
int i;
|
||||
for (i = 0; i < bytes_in; i++)
|
||||
out_data[i] = ~in_data[i];
|
||||
out_data[bytes_in] = 0;
|
||||
out_data[bytes_in + 1] = 0;
|
||||
*bytes_out = bytes_in + 2;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user