summaryrefslogtreecommitdiff
path: root/src/latex.c
diff options
context:
space:
mode:
authorMarco Benelli <mbenelli@yahoo.com>2015-11-02 13:19:04 +0100
committerMarco Benelli <mbenelli@yahoo.com>2015-11-02 13:19:04 +0100
commit0b5a8193fdc7b041023e44149a1d63b95ce98bfd (patch)
treead56de935f0c137db455a6f5d75304d50e0bae6e /src/latex.c
parentb95def0719d823eb6bc11780ce8729d89c3ebf69 (diff)
Replaced sprintf with snprintf.
Diffstat (limited to 'src/latex.c')
-rw-r--r--src/latex.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/latex.c b/src/latex.c
index 146062e..7170fab 100644
--- a/src/latex.c
+++ b/src/latex.c
@@ -208,7 +208,8 @@ static int S_get_enumlevel(cmark_node *node) {
static int S_render_node(cmark_renderer *renderer, cmark_node *node,
cmark_event_type ev_type, int options) {
int list_number;
- char list_number_string[20];
+ const size_t LIST_NUMBER_STRING_SIZE = 20;
+ char list_number_string[LIST_NUMBER_STRING_SIZE];
bool entering = (ev_type == CMARK_EVENT_ENTER);
cmark_list_type list_type;
const char *roman_numerals[] = {"", "i", "ii", "iii", "iv", "v",
@@ -240,7 +241,8 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node,
CR();
list_number = cmark_node_get_list_start(node);
if (list_number > 1) {
- sprintf(list_number_string, "%d", list_number);
+ snprintf(list_number_string, LIST_NUMBER_STRING_SIZE, "%d",
+ list_number);
LIT("\\setcounter{enum");
LIT((char *)roman_numerals[S_get_enumlevel(node)]);
LIT("}{");