examples: Don't use sprintf
Avoids warnings on macOS.
diff --git a/doc/examples/tree2.c b/doc/examples/tree2.c
index 78dcac1..ef137af 100644
--- a/doc/examples/tree2.c
+++ b/doc/examples/tree2.c
@@ -80,10 +80,10 @@
* A simple loop that "automates" nodes creation
*/
for (i = 5; i < 7; i++) {
- sprintf(buff, "node%d", i);
+ snprintf(buff, sizeof(buff), "node%d", i);
node = xmlNewChild(root_node, NULL, BAD_CAST buff, NULL);
for (j = 1; j < 4; j++) {
- sprintf(buff, "node%d%d", i, j);
+ snprintf(buff, sizeof(buff), "node%d%d", i, j);
node1 = xmlNewChild(node, NULL, BAD_CAST buff, NULL);
xmlNewProp(node1, BAD_CAST "odd", BAD_CAST((j % 2) ? "no" : "yes"));
}