diff options
| author | Don Kjer <don@lindenlab.com> | 2007-05-02 21:24:47 +0000 | 
|---|---|---|
| committer | Don Kjer <don@lindenlab.com> | 2007-05-02 21:24:47 +0000 | 
| commit | 1c909afe3998778e4cc045c9ab733e8afbf7c25b (patch) | |
| tree | 75c00a32a8e305280cbec253195d1113d628fc3e /indra/llprimitive | |
| parent | bc59c04653bf1404e8148a8169208b146a123b28 (diff) | |
svn merge -r 60342:61148 svn+ssh://svn/svn/linden/branches/maintenance into release
Diffstat (limited to 'indra/llprimitive')
| -rw-r--r-- | indra/llprimitive/llprimitive.cpp | 15 | 
1 files changed, 10 insertions, 5 deletions
| diff --git a/indra/llprimitive/llprimitive.cpp b/indra/llprimitive/llprimitive.cpp index fa0b4747e6..13719d0a62 100644 --- a/indra/llprimitive/llprimitive.cpp +++ b/indra/llprimitive/llprimitive.cpp @@ -777,14 +777,14 @@ const char * LLPrimitive::pCodeToString(const LLPCode pcode)  		{  			snprintf(mask, sizeof(mask), "hemi");		/* Flawfinder: ignore */  		} -		else if (mask != 0) +		else   		{  			snprintf(mask, sizeof(mask), "%x", mask_code);		/* Flawfinder: ignore */  		} -		else -		{ -			mask[0] = 0; -		} + +		// extra sanity against snprintf() being naturally crap +		mask[sizeof(mask)-1] = '\0'; +		shape[sizeof(shape)-1] = '\0';  		if (mask[0])  		{ @@ -795,6 +795,11 @@ const char * LLPrimitive::pCodeToString(const LLPCode pcode)  			snprintf(pcode_string, sizeof(pcode_string), "%s", shape);		/* Flawfinder: ignore */  		}  	} + +	// Be really sure that pcode_string is nul-terminated after we've +	// been using crappy snprintf() to build it. +	pcode_string[sizeof(pcode_string)-1] = '\0'; +  	return pcode_string;  } | 
