diff options
author | Steven Bennetts <steve@lindenlab.com> | 2007-01-18 00:36:25 +0000 |
---|---|---|
committer | Steven Bennetts <steve@lindenlab.com> | 2007-01-18 00:36:25 +0000 |
commit | 73f0b5029aa247a563862fc39152ce58baa407aa (patch) | |
tree | 656b4b9d02c3c81d184ebf2915fe8c073e9335e2 /indra/llmessage | |
parent | 71d28bdbf0baab9302c8f458e3bdbcfc60d656d4 (diff) |
merge -r 56738:56842 maintenance.
Diffstat (limited to 'indra/llmessage')
-rw-r--r-- | indra/llmessage/lldatapacker.cpp | 17 | ||||
-rw-r--r-- | indra/llmessage/lldatapacker.h | 8 | ||||
-rw-r--r-- | indra/llmessage/lltransfersourcefile.cpp | 4 |
3 files changed, 14 insertions, 15 deletions
diff --git a/indra/llmessage/lldatapacker.cpp b/indra/llmessage/lldatapacker.cpp index bc9f4f3486..627f77d4d8 100644 --- a/indra/llmessage/lldatapacker.cpp +++ b/indra/llmessage/lldatapacker.cpp @@ -165,14 +165,15 @@ BOOL LLDataPackerBinaryBuffer::packString(const char *value, const char *name) } -BOOL LLDataPackerBinaryBuffer::unpackString(char *value, const char *name) +BOOL LLDataPackerBinaryBuffer::unpackString(std::string& value, const char *name) { BOOL success = TRUE; S32 length = (S32)strlen((char *)mCurBufferp) + 1; /*Flawfinder: ignore*/ success &= verifyLength(length, name); - htonmemcpy(value, mCurBufferp, MVT_VARIABLE, length); + value = std::string((char*)mCurBufferp); // We already assume NULL termination calling strlen() + mCurBufferp += length; return success; } @@ -584,16 +585,16 @@ BOOL LLDataPackerAsciiBuffer::packString(const char *value, const char *name) return success; } -BOOL LLDataPackerAsciiBuffer::unpackString(char *value, const char *name) +BOOL LLDataPackerAsciiBuffer::unpackString(std::string& value, const char *name) { BOOL success = TRUE; char valuestr[DP_BUFSIZE]; /*Flawfinder: ignore*/ - if (!getValueStr(name, valuestr, DP_BUFSIZE)) + BOOL res = getValueStr(name, valuestr, DP_BUFSIZE); // NULL terminated + if (!res) // { return FALSE; } - // XXXCHECK: Can result in buffer overrun. Need to pass in size for "value" - strcpy(value, valuestr); /*Flawfinder: ignore*/ + value = valuestr; return success; } @@ -1312,7 +1313,7 @@ BOOL LLDataPackerAsciiFile::packString(const char *value, const char *name) return success; } -BOOL LLDataPackerAsciiFile::unpackString(char *value, const char *name) +BOOL LLDataPackerAsciiFile::unpackString(std::string& value, const char *name) { BOOL success = TRUE; char valuestr[DP_BUFSIZE]; /* Flawfinder: ignore */ @@ -1320,7 +1321,7 @@ BOOL LLDataPackerAsciiFile::unpackString(char *value, const char *name) { return FALSE; } - strncpy(value, valuestr,DP_BUFSIZE); + value = valuestr; return success; } diff --git a/indra/llmessage/lldatapacker.h b/indra/llmessage/lldatapacker.h index 10ca35d2c7..01c3ebb347 100644 --- a/indra/llmessage/lldatapacker.h +++ b/indra/llmessage/lldatapacker.h @@ -32,7 +32,7 @@ public: virtual BOOL hasNext() const = 0; virtual BOOL packString(const char *value, const char *name) = 0; - virtual BOOL unpackString(char *value, const char *name) = 0; + virtual BOOL unpackString(std::string& value, const char *name) = 0; virtual BOOL packBinaryData(const U8 *value, S32 size, const char *name) = 0; virtual BOOL unpackBinaryData(U8 *value, S32 &size, const char *name) = 0; @@ -110,7 +110,7 @@ public: } /*virtual*/ BOOL packString(const char *value, const char *name); - /*virtual*/ BOOL unpackString(char *value, const char *name); + /*virtual*/ BOOL unpackString(std::string& value, const char *name); /*virtual*/ BOOL packBinaryData(const U8 *value, S32 size, const char *name); /*virtual*/ BOOL unpackBinaryData(U8 *value, S32 &size, const char *name); @@ -212,7 +212,7 @@ public: } /*virtual*/ BOOL packString(const char *value, const char *name); - /*virtual*/ BOOL unpackString(char *value, const char *name); + /*virtual*/ BOOL unpackString(std::string& value, const char *name); /*virtual*/ BOOL packBinaryData(const U8 *value, S32 size, const char *name); /*virtual*/ BOOL unpackBinaryData(U8 *value, S32 &size, const char *name); @@ -341,7 +341,7 @@ public: } /*virtual*/ BOOL packString(const char *value, const char *name); - /*virtual*/ BOOL unpackString(char *value, const char *name); + /*virtual*/ BOOL unpackString(std::string& value, const char *name); /*virtual*/ BOOL packBinaryData(const U8 *value, S32 size, const char *name); /*virtual*/ BOOL unpackBinaryData(U8 *value, S32 &size, const char *name); diff --git a/indra/llmessage/lltransfersourcefile.cpp b/indra/llmessage/lltransfersourcefile.cpp index c1df0f25aa..0d58bf7917 100644 --- a/indra/llmessage/lltransfersourcefile.cpp +++ b/indra/llmessage/lltransfersourcefile.cpp @@ -144,9 +144,7 @@ void LLTransferSourceParamsFile::packParams(LLDataPacker &dp) const BOOL LLTransferSourceParamsFile::unpackParams(LLDataPacker &dp) { - char tmp_str[512]; /* Flawfinder: ignore */ - dp.unpackString(tmp_str, "Filename"); - mFilename = tmp_str; + dp.unpackString(mFilename, "Filename"); U8 delete_flag; dp.unpackU8(delete_flag, "Delete"); mDeleteOnCompletion = delete_flag; |