From b01c75cb423f07a3d3354f8bd62f265f80062b3b Mon Sep 17 00:00:00 2001
From: Adam Moss <moss@lindenlab.com>
Date: Thu, 16 Apr 2009 23:45:35 +0000
Subject: svn merge -r117314:117337
 svn+ssh://svn.lindenlab.com/svn/linden/branches/moss/mv13a-merge-1

QAR-1343 maint-viewer-13a+libcurlexploitfix-3-3 combo merge
---
 indra/llinventory/llinventory.cpp | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

(limited to 'indra/llinventory')

diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp
index 4dddd9de3e..2823cf7be9 100644
--- a/indra/llinventory/llinventory.cpp
+++ b/indra/llinventory/llinventory.cpp
@@ -1257,23 +1257,19 @@ void LLInventoryItem::unpackBinaryBucket(U8* bin_bucket, S32 bin_bucket_size)
 	// Early exit on an empty binary bucket.
 	if (bin_bucket_size <= 1) return;
 
-	// Convert the bin_bucket into a string.
-	char* item_buffer = new char[bin_bucket_size+1];
-	if ((item_buffer != NULL) && (bin_bucket != NULL))
-	{
-		memcpy(item_buffer, bin_bucket, bin_bucket_size);	/* Flawfinder: ignore */
-	}
-	else
+	if (NULL == bin_bucket)
 	{
-		llerrs << "unpackBinaryBucket failed. item_buffer or bin_bucket is Null." << llendl;
-		delete[] item_buffer;
+		llerrs << "unpackBinaryBucket failed.  bin_bucket is NULL." << llendl;
 		return;
 	}
+
+	// Convert the bin_bucket into a string.
+	std::vector<char> item_buffer(bin_bucket_size+1);
+	memcpy(&item_buffer[0], bin_bucket, bin_bucket_size);	/* Flawfinder: ignore */
 	item_buffer[bin_bucket_size] = '\0';
-	std::string str(item_buffer);
+	std::string str(&item_buffer[0]);
 
-	lldebugs << "item buffer: " << item_buffer << llendl;
-	delete[] item_buffer;
+	lldebugs << "item buffer: " << str << llendl;
 
 	// Tokenize the string.
 	typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
-- 
cgit v1.2.3