aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llprimitive/llprimitive.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llprimitive/llprimitive.cpp')
-rw-r--r--linden/indra/llprimitive/llprimitive.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/linden/indra/llprimitive/llprimitive.cpp b/linden/indra/llprimitive/llprimitive.cpp
index e2cf7e3..9ab44f7 100644
--- a/linden/indra/llprimitive/llprimitive.cpp
+++ b/linden/indra/llprimitive/llprimitive.cpp
@@ -797,14 +797,14 @@ const char * LLPrimitive::pCodeToString(const LLPCode pcode)
797 { 797 {
798 snprintf(mask, sizeof(mask), "hemi"); /* Flawfinder: ignore */ 798 snprintf(mask, sizeof(mask), "hemi"); /* Flawfinder: ignore */
799 } 799 }
800 else if (mask != 0) 800 else
801 { 801 {
802 snprintf(mask, sizeof(mask), "%x", mask_code); /* Flawfinder: ignore */ 802 snprintf(mask, sizeof(mask), "%x", mask_code); /* Flawfinder: ignore */
803 } 803 }
804 else 804
805 { 805 // extra sanity against snprintf() being naturally crap
806 mask[0] = 0; 806 mask[sizeof(mask)-1] = '\0';
807 } 807 shape[sizeof(shape)-1] = '\0';
808 808
809 if (mask[0]) 809 if (mask[0])
810 { 810 {
@@ -815,6 +815,11 @@ const char * LLPrimitive::pCodeToString(const LLPCode pcode)
815 snprintf(pcode_string, sizeof(pcode_string), "%s", shape); /* Flawfinder: ignore */ 815 snprintf(pcode_string, sizeof(pcode_string), "%s", shape); /* Flawfinder: ignore */
816 } 816 }
817 } 817 }
818
819 // Be really sure that pcode_string is nul-terminated after we've
820 // been using crappy snprintf() to build it.
821 pcode_string[sizeof(pcode_string)-1] = '\0';
822
818 return pcode_string; 823 return pcode_string;
819} 824}
820 825