mirror of
https://github.com/vdr-projects/vdr.git
synced 2025-03-01 10:50:46 +00:00
Made CharArray::DataOwnData::assign() in 'libsi' more robust against invalid data and changed CharArray::DataOwnData::Delete() so that it sets 'size' and 'data' to 0
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* $Id: util.c 1.6 2006/02/18 10:38:20 kls Exp $
|
||||
* $Id: util.c 1.7 2006/02/18 11:17:50 kls Exp $
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
@@ -119,6 +119,8 @@ CharArray::DataOwnData::~DataOwnData() {
|
||||
|
||||
void CharArray::DataOwnData::assign(const unsigned char*d, int s) {
|
||||
Delete();
|
||||
if (!d || s > 100000 || s <= 0) // ultimate plausibility check
|
||||
return;
|
||||
size=s;
|
||||
unsigned char *newdata=new unsigned char[size];
|
||||
memcpy(newdata, d, size);
|
||||
@@ -127,6 +129,8 @@ void CharArray::DataOwnData::assign(const unsigned char*d, int s) {
|
||||
|
||||
void CharArray::DataOwnData::Delete() {
|
||||
delete[] data;
|
||||
size=0;
|
||||
data=0;
|
||||
}
|
||||
|
||||
CharArray::DataForeignData::~DataForeignData() {
|
||||
|
Reference in New Issue
Block a user