summaryrefslogtreecommitdiff
path: root/indra/llcommon/llsdserialize.cpp
diff options
context:
space:
mode:
authorJosh Bell <josh@lindenlab.com>2008-02-28 18:15:01 +0000
committerJosh Bell <josh@lindenlab.com>2008-02-28 18:15:01 +0000
commit2fdd7c35f33d1d98091547b8e96ad9ebf99dee47 (patch)
tree247ba5247139531ac636bb8b9db7ddf3d5ce6203 /indra/llcommon/llsdserialize.cpp
parent42bc4ba02abebced9fc3e7f91317ae293cbd20dd (diff)
svn merge -r 80357:80990 svn+ssh://svn.lindenlab.com/svn/linden/branches/Branch_1-19-1-Server --> release
Merge patches from 1.19.1 Server branch: * QAR-293 Fix for hardcoded TTLs in web dataservices * DEV-10826 fix for busted binary and notation parse if handed an unlimited parse size * Bounce apache2 processes before starting backbone/dataserver/simulator * Changing web-ds TTL in a way that any query that has 0 < ttl <=60 will have ttl = 61. * Partial reversion of multiagent-chat to 1.19.0 to address fast memory leak * Fixed minor, non user facing bug in multiagentchat * set-classified-stats: Rewrote to use new MDB2 query reformatting syntax * Fixed possible bad conversion of vivox data * DEV-550, caching changes to DirClassifieds Query * QAR-240 (DEV-8488) Prevent residents from purging stuff that isn't trash on the backend * More mem leak fixes for multiagent-chat * QAR-274 Fetch inventory descendents over TCP (via HTTP cap) instead of UDP * DEV-10151: Sometimes group IMs appear to be person to person IMs * QAR-321 Changes to crash_reporter * DEV-11004 Speed up people search query using FORCE INDEX (PRIMARY) on the username table if the first-name query fragment is >= 3 chars * DEV-11004 Speed up people search query using FORCE INDEX (PRIMARY). Web service version of this, must use two named queries because we need to change the query based on input string length.
Diffstat (limited to 'indra/llcommon/llsdserialize.cpp')
-rw-r--r--indra/llcommon/llsdserialize.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp
index 02152cfe79..6f4a49180d 100644
--- a/indra/llcommon/llsdserialize.cpp
+++ b/indra/llcommon/llsdserialize.cpp
@@ -227,7 +227,8 @@ F64 ll_ntohd(F64 netdouble)
*
* @param istr The stream to read from.
* @param value [out] The string which was found.
- * @param max_bytes The maximum possible length of the string.
+ * @param max_bytes The maximum possible length of the string. Passing in
+ * a negative value will skip this check.
* @return Returns number of bytes read off of the stream. Returns
* PARSE_FAILURE (-1) on failure.
*/
@@ -251,7 +252,8 @@ int deserialize_string_delim(std::istream& istr, std::string& value, char d);
* leading the stream.
* @param value [out] The string which was found.
* @param d The delimiter to use.
- * @param max_bytes The maximum possible length of the string.
+ * @param max_bytes The maximum possible length of the string. Passing in
+ * a negative value will skip this check.
* @return Returns number of bytes read off of the stream. Returns
* PARSE_FAILURE (-1) on failure.
*/
@@ -768,7 +770,7 @@ bool LLSDNotationParser::parseBinary(std::istream& istr, LLSD& data) const
// We probably have a valid raw binary stream. determine
// the size, and read it.
S32 len = strtol(buf + 2, NULL, 0);
- if(len > mMaxBytesLeft) return false;
+ if(mCheckLimits && (len > mMaxBytesLeft)) return false;
std::vector<U8> value;
if(len)
{
@@ -1043,7 +1045,7 @@ S32 LLSDBinaryParser::doParse(std::istream& istr, LLSD& data) const
U32 size_nbo = 0;
read(istr, (char*)&size_nbo, sizeof(U32)); /*Flawfinder: ignore*/
S32 size = (S32)ntohl(size_nbo);
- if(size > mMaxBytesLeft)
+ if(mCheckLimits && (size > mMaxBytesLeft))
{
parse_count = PARSE_FAILURE;
}
@@ -1179,7 +1181,7 @@ bool LLSDBinaryParser::parseString(
U32 value_nbo = 0;
read(istr, (char*)&value_nbo, sizeof(U32)); /*Flawfinder: ignore*/
S32 size = (S32)ntohl(value_nbo);
- if(size > mMaxBytesLeft) return false;
+ if(mCheckLimits && (size > mMaxBytesLeft)) return false;
std::vector<char> buf;
if(size)
{
@@ -1635,7 +1637,7 @@ int deserialize_string_raw(
// the size, and read it.
// *FIX: This is memory inefficient.
S32 len = strtol(buf + 1, NULL, 0);
- if(len > max_bytes) return LLSDParser::PARSE_FAILURE;
+ if((max_bytes>0)&&(len>max_bytes)) return LLSDParser::PARSE_FAILURE;
std::vector<char> buf;
if(len)
{