Index: src/core/SkRegion.cpp |
diff --git a/src/core/SkRegion.cpp b/src/core/SkRegion.cpp |
index a50425afd8e9d4f0bb2f3601db9d332e5f47a3a8..b3b1831aedcaae1a8063f73832ae51edbfd48e09 100644 |
--- a/src/core/SkRegion.cpp |
+++ b/src/core/SkRegion.cpp |
@@ -196,14 +196,15 @@ char* SkRegion::toString() { |
if (result == nullptr) { |
return nullptr; |
} |
- count = sprintf(result, "SkRegion("); |
+ count = snprintf(result, max, "SkRegion("); |
iter.reset(*this); |
while (!iter.done()) { |
const SkIRect& r = iter.rect(); |
- count += sprintf(result+count, "(%d,%d,%d,%d)", r.fLeft, r.fTop, r.fRight, r.fBottom); |
+ count += snprintf(result+count, max - count, |
+ "(%d,%d,%d,%d)", r.fLeft, r.fTop, r.fRight, r.fBottom); |
iter.next(); |
} |
- count += sprintf(result+count, ")"); |
+ count += snprintf(result+count, max - count, ")"); |
return result; |
} |
#endif |