diff --git a/reactos/subsys/system/explorer/utility/utility.h b/reactos/subsys/system/explorer/utility/utility.h index 73049d76f5f..9ef4ef759ff 100644 --- a/reactos/subsys/system/explorer/utility/utility.h +++ b/reactos/subsys/system/explorer/utility/utility.h @@ -166,6 +166,7 @@ BOOL exists_path(LPCTSTR path); #endif + // secure CRT functions #ifdef __STDC_WANT_SECURE_LIB__ // for VS 2005: _MSC_VER>=1400 #undef _vsntprintf diff --git a/reactos/subsys/system/explorer/utility/xmlstorage.cpp b/reactos/subsys/system/explorer/utility/xmlstorage.cpp index ef25d97bf1a..540bf01c415 100644 --- a/reactos/subsys/system/explorer/utility/xmlstorage.cpp +++ b/reactos/subsys/system/explorer/utility/xmlstorage.cpp @@ -464,7 +464,7 @@ std::string XMLReaderBase::get_error_string() const std::string EncodeXMLString(const XS_String& str) { LPCXSSTR s = str.c_str(); - LPXSSTR buffer = (LPXSSTR)alloca(5*sizeof(XS_CHAR)*XS_len(s)); // worst case. "&" + LPXSSTR buffer = (LPXSSTR)alloca(6*sizeof(XS_CHAR)*XS_len(s)); // worst case """ / "'" LPXSSTR o = buffer; for(LPCXSSTR p=s; *p; ++p) @@ -492,7 +492,7 @@ std::string EncodeXMLString(const XS_String& str) default: if ((unsigned)*p<20 && *p!='\t' && *p!='\r' && *p!='\n') { char b[16]; - sprintf(b, "&%d;", (unsigned)*p); + sprintf_s1(b, COUNTOF(b), "&%d;", (unsigned)*p); for(const char*q=b; *q; ) *o++ = *q++; } else diff --git a/reactos/subsys/system/explorer/utility/xmlstorage.h b/reactos/subsys/system/explorer/utility/xmlstorage.h index 7b3d0abacbe..067e5232118 100644 --- a/reactos/subsys/system/explorer/utility/xmlstorage.h +++ b/reactos/subsys/system/explorer/utility/xmlstorage.h @@ -71,6 +71,14 @@ namespace XMLStorage { + // secure CRT functions +#ifdef __STDC_WANT_SECURE_LIB__ // VS 2005 +#define sprintf_s1 sprintf_s +#else +#define sprintf_s1(b, l, f, p1) sprintf(b, f, p1) +#endif + + #ifndef XS_String #ifdef XS_STRING_UTF8