[sldev] VWR-176

Nicholaz Beresford nicholaz at blueflash.cc
Wed Jun 6 12:33:24 PDT 2007


Attached is a patch for 176.  Nice one had me on the wrong
track for a while.

As it seems, snprintf goes to a safe_snprintf which insists on
putting a zero at the end of the buffer, no matter what.

Line numbers in the patch may be off a bit, I deleted the
hunk that was VWR-808 in the same file.


Nick

-- 
Second Life from the inside out:
http://nicholaz-beresford.blogspot.com/
-------------- next part --------------

# XP [W:\sl1.16.0.5]udiff linden-orig/indra/llmessage/message.cpp linden/indra/llmessage/message.cpp 
--- linden-orig/indra/llmessage/message.cpp	2007-05-23 11:55:56.000000000 +0200
+++ linden/indra/llmessage/message.cpp	2007-06-06 21:09:21.906250000 +0200
@@ -4154,14 +4181,19 @@
 {
 	llwarns << "Packet Dump from:" << mPacketRing.getLastSender() << llendl;
 	llwarns << "Packet Size:" << mTrueReceiveSize << llendl;
+
 	char line_buffer[256];		/* Flawfinder: ignore */
 	S32 i;
 	S32 cur_line_pos = 0;
-
 	S32 cur_line = 0;
+	S32 buf_offset;
+
+	memset(line_buffer, 0xFE, sizeof(line_buffer));
+
 	for (i = 0; i < mTrueReceiveSize; i++)
 	{
-		snprintf(line_buffer + cur_line_pos*3, sizeof(line_buffer),"%02x ", mTrueReceiveBuffer[i]);	/* Flawfinder: ignore */
+		buf_offset = cur_line_pos*3;
+		snprintf(line_buffer + buf_offset, sizeof(line_buffer)-buf_offset, "%02x ", mTrueReceiveBuffer[i]);	/* Flawfinder: ignore */
 		cur_line_pos++;
 		if (cur_line_pos >= 16)
 		{


More information about the SLDev mailing list