diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2006-02-18 11:21:00 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2006-02-18 11:21:00 +0100 |
commit | 273d6c53a68566f31f4241bf094416956bde9562 (patch) | |
tree | 693dc079a42358e0e7cf4b0eeca3e42bff7a086f /libsi | |
parent | b8cdca858b29807fab2a3f0b01d745da6e804e61 (diff) | |
download | vdr-273d6c53a68566f31f4241bf094416956bde9562.tar.gz vdr-273d6c53a68566f31f4241bf094416956bde9562.tar.bz2 |
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
Diffstat (limited to 'libsi')
-rw-r--r-- | libsi/util.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libsi/util.c b/libsi/util.c index bbdf86b2..b0db93e1 100644 --- a/libsi/util.c +++ b/libsi/util.c @@ -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() { |