summaryrefslogtreecommitdiff
path: root/src/html.c
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2016-01-18 09:26:14 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2016-01-18 09:26:14 -0800
commit7e1f8b8e49ca291a7757c55a8e02fc7a85d1434c (patch)
tree1c777b0fd81cb44d2dc50a95c915491b04bf6670 /src/html.c
parentac812214f6fa81b201b8fcf3779ed8d2c3cfacf7 (diff)
parent0b5a8193fdc7b041023e44149a1d63b95ce98bfd (diff)
Merge branch 'master' of https://github.com/mbenelli/cmark into mbenelli-master
Diffstat (limited to 'src/html.c')
-rw-r--r--src/html.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/html.c b/src/html.c
index 54f27ba..27e0586 100644
--- a/src/html.c
+++ b/src/html.c
@@ -29,11 +29,12 @@ struct render_state {
static void S_render_sourcepos(cmark_node *node, cmark_strbuf *html,
int options) {
- char buffer[100];
+ const size_t BUFFER_SIZE = 100;
+ char buffer[BUFFER_SIZE];
if (CMARK_OPT_SOURCEPOS & options) {
- sprintf(buffer, " data-sourcepos=\"%d:%d-%d:%d\"",
- cmark_node_get_start_line(node), cmark_node_get_start_column(node),
- cmark_node_get_end_line(node), cmark_node_get_end_column(node));
+ snprintf(buffer, BUFFER_SIZE, " data-sourcepos=\"%d:%d-%d:%d\"",
+ cmark_node_get_start_line(node), cmark_node_get_start_column(node),
+ cmark_node_get_end_line(node), cmark_node_get_end_column(node));
cmark_strbuf_puts(html, buffer);
}
}
@@ -46,7 +47,8 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type,
char start_heading[] = "<h0";
char end_heading[] = "</h0";
bool tight;
- char buffer[100];
+ const size_t BUFFER_SIZE = 100;
+ char buffer[BUFFER_SIZE];
bool entering = (ev_type == CMARK_EVENT_ENTER);
@@ -104,7 +106,7 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type,
S_render_sourcepos(node, html, options);
cmark_strbuf_puts(html, ">\n");
} else {
- sprintf(buffer, "<ol start=\"%d\"", start);
+ snprintf(buffer, BUFFER_SIZE, "<ol start=\"%d\"", start);
cmark_strbuf_puts(html, buffer);
S_render_sourcepos(node, html, options);
cmark_strbuf_puts(html, ">\n");