Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/simpleini.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrodie Thiesfield <brofield@gmail.com>2008-02-29 04:40:07 +0300
committerBrodie Thiesfield <brofield@gmail.com>2008-02-29 04:40:07 +0300
commit11c66a24cd2225abb82d1dcb6646f6f44c975a29 (patch)
tree54a0e6c3964dbe06b78cb2b1d680ec6e4f941d8f
parent89a231cda27441338dbbdd7c5721deb2a976914c (diff)
handle 0 length input
-rw-r--r--SimpleIni.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/SimpleIni.h b/SimpleIni.h
index 78ebfb0..5571d64 100644
--- a/SimpleIni.h
+++ b/SimpleIni.h
@@ -1147,6 +1147,9 @@ CSimpleIniTempl<SI_CHAR,SI_STRLESS,SI_CONVERTER>::LoadFile(
if (lSize < 0) {
return SI_FILE;
}
+ if (lSize == 0) {
+ return SI_OK;
+ }
char * pData = new char[lSize];
if (!pData) {
return SI_NOMEM;
@@ -1173,6 +1176,10 @@ CSimpleIniTempl<SI_CHAR,SI_STRLESS,SI_CONVERTER>::Load(
{
SI_CONVERTER converter(m_bStoreIsUtf8);
+ if (a_uDataLen == 0) {
+ return SI_OK;
+ }
+
// consume the UTF-8 BOM if it exists
if (m_bStoreIsUtf8 && a_uDataLen >= 3) {
if (memcmp(a_pData, SI_UTF8_SIGNATURE, 3) == 0) {