Index: ext/libicpf/src/libicpf/cfg_xml.cpp =================================================================== diff -u -rf59b3a0da37558c2af6b13a6a88ed16196c05832 -r361d7f8b9268e18f39e298ea82425f7ddb24fb43 --- ext/libicpf/src/libicpf/cfg_xml.cpp (.../cfg_xml.cpp) (revision f59b3a0da37558c2af6b13a6a88ed16196c05832) +++ ext/libicpf/src/libicpf/cfg_xml.cpp (.../cfg_xml.cpp) (revision 361d7f8b9268e18f39e298ea82425f7ddb24fb43) @@ -1,5 +1,5 @@ #include "cfg_xml.h" -#include +//#include #include "exception.h" #include #include Index: ext/libicpf/src/libicpf/circ_buffer.cpp =================================================================== diff -u -rb337c059691a6940b52a86388ff427c734be8eb6 -r361d7f8b9268e18f39e298ea82425f7ddb24fb43 --- ext/libicpf/src/libicpf/circ_buffer.cpp (.../circ_buffer.cpp) (revision b337c059691a6940b52a86388ff427c734be8eb6) +++ ext/libicpf/src/libicpf/circ_buffer.cpp (.../circ_buffer.cpp) (revision 361d7f8b9268e18f39e298ea82425f7ddb24fb43) @@ -21,6 +21,8 @@ #include #include #include +#include "err_codes.h" +#include "exception.h" BEGIN_ICPF_NAMESPACE @@ -267,6 +269,9 @@ int circular_buffer::forward_seek(ulong_t ulFnd) { assert(m_pbyBuffer); + if(!m_pbyBuffer) + THROW(_t("Invalid member"), GE_INVALIDARG, 0, 0); + if (m_tDataSize < sizeof(ulong_t)) return FS_PARTIAL; // cannot tell if there is such a value (may be a part of it) @@ -471,7 +476,9 @@ assert(m_pbyBuffer); assert(ulBitsCount >= 1 && ulBitsCount <=8); assert(pfn); - + if(!pfn || ! m_pbyBuffer || ulBitsCount < 1 || ulBitsCount > 8) + THROW(_t("Invalid member or argument"), GE_INVALIDARG, 0, 0); + ushort_t w=0; // internal buffer for the next data from the class's buffer ulong_t ulBits=0; // count of bits that was left in w Index: ext/libicpf/src/libicpf/config_property.cpp =================================================================== diff -u -rb337c059691a6940b52a86388ff427c734be8eb6 -r361d7f8b9268e18f39e298ea82425f7ddb24fb43 --- ext/libicpf/src/libicpf/config_property.cpp (.../config_property.cpp) (revision b337c059691a6940b52a86388ff427c734be8eb6) +++ ext/libicpf/src/libicpf/config_property.cpp (.../config_property.cpp) (revision 361d7f8b9268e18f39e298ea82425f7ddb24fb43) @@ -1,4 +1,6 @@ #include "config_property.h" +#include "exception.h" +#include "err_codes.h" #include #include @@ -318,6 +320,8 @@ const tchar_t* property::get_value(tchar_t* pszString, size_t stMaxSize, size_t stIndex) { assert(pszString); + if(!pszString) + THROW(_t("Invalid argument"), GE_INVALIDARG, 0, 0); if (m_uiPropType & flag_array) { @@ -880,6 +884,9 @@ bool property::bool_from_string(const tchar_t* pszSrc) { assert(pszSrc); + if(!pszSrc) + THROW(_t("Invalid argument"), GE_INVALIDARG, 0, 0); + return pszSrc[0] != _t('0'); } Index: ext/libicpf/src/libicpf/crc32.cpp =================================================================== diff -u -rb337c059691a6940b52a86388ff427c734be8eb6 -r361d7f8b9268e18f39e298ea82425f7ddb24fb43 --- ext/libicpf/src/libicpf/crc32.cpp (.../crc32.cpp) (revision b337c059691a6940b52a86388ff427c734be8eb6) +++ ext/libicpf/src/libicpf/crc32.cpp (.../crc32.cpp) (revision 361d7f8b9268e18f39e298ea82425f7ddb24fb43) @@ -22,6 +22,8 @@ */ #include "crc32.h" +#include "err_codes.h" +#include "exception.h" #include #ifndef _WIN32 #include @@ -131,6 +133,9 @@ void crc32_begin(uint_t *puiValue) { assert(puiValue != NULL); + if(!puiValue) + THROW(_t("Invalid argument"), GE_INVALIDARG, 0, 0); + *puiValue=0xffffffff; } @@ -143,6 +148,8 @@ void crc32_partial(uint_t *puiPrev, const byte_t *pbyData, size_t tLen) { assert(puiPrev && pbyData); + if(!puiPrev || !pbyData) + THROW(_t("Invalid argument"), GE_INVALIDARG, 0, 0); for (size_t i=0;i = sizeof(__logtype_str)) + return; // log time time_t t=time(NULL); @@ -571,7 +577,8 @@ // format a string with err no and desc tchar_t szError[1024]; - _sntprintf(szError, 1024, _t("0x%lx (%s)"), iSysErr, pszErrDesc); + _sntprintf(szError, 1023, _t("0x%lx (%s)"), iSysErr, pszErrDesc); + szError[1023] = _T('\0'); // replace %err with the new data pszOut[0]=_t('\0');