Commit 12758ffa authored by Ghislain MARY's avatar Ghislain MARY

Prevent crash in generic_plc_update_continuity_buffer().

parent e86b5e20
......@@ -193,7 +193,10 @@ void generic_plc_update_plc_buffer(plc_context_t *context, unsigned char *data,
void generic_plc_update_continuity_buffer(plc_context_t *context, unsigned char *data, size_t data_len) {
size_t transitionBufferSize = context->sample_rate*sizeof(int16_t)*TRANSITION_DELAY/1000;
unsigned char *buffer=ms_malloc(transitionBufferSize);
unsigned char *buffer;
if (transitionBufferSize > data_len) transitionBufferSize = data_len;
buffer=ms_malloc(transitionBufferSize);
/* get the last TRANSITION_DELAY ms in a temp buffer */
memcpy(buffer, data+data_len-transitionBufferSize, transitionBufferSize);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment