fixed potential integer overflow / Out of bounds read in RsVOIPDataItem.cc

This commit is contained in:
csoler 2016-01-11 20:26:19 -05:00
parent 98f0c101b9
commit 6e9d96efd8

View File

@ -447,6 +447,9 @@ RsVOIPDataItem::RsVOIPDataItem(void *data, uint32_t pktsize)
ok &= getRawUInt32(data, rssize, &offset, &flags);
ok &= getRawUInt32(data, rssize, &offset, &data_size);
if(data_size > rssize || rssize - data_size < offset)
throw std::runtime_error("Not enough space.") ;
voip_data = malloc(data_size) ;
memcpy(voip_data,&((uint8_t*)data)[offset],data_size) ;
offset += data_size ;