From 4e80effe0ec3edcef9e2f240864eacab9cdbb035 Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Wed, 26 Aug 2009 14:25:20 +0200 Subject: Replace sprintf with snprintf --- export_xml.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'export_xml.c') diff --git a/export_xml.c b/export_xml.c index ffdeffc..4485f9d 100644 --- a/export_xml.c +++ b/export_xml.c @@ -24,7 +24,7 @@ int export_xml(struct channel_t *channel, struct user_t *users) { xmlNodePtr hour_node = xmlNewChild(lines_node, NULL, "hour", NULL); for(int q = 0; q < 4; q++) { char s[0xf]; - sprintf(s, "%d", channel->hours[h*4 + q]); + snprintf(s, 0xf, "%d", channel->hours[h*4 + q]); xmlNewChild(hour_node, NULL, "quarter", s); } } @@ -39,7 +39,7 @@ int export_xml(struct channel_t *channel, struct user_t *users) { xmlNodePtr user_node = xmlNewChild(users_node, NULL, "user", NULL); xmlNewChild(user_node, NULL, "nick", user->nick); - sprintf(s, "%d", user->words); + snprintf(s, 0xf, "%d", user->words); xmlNewChild(user_node, NULL, "words", s); /* Add lines for this user. */ @@ -47,7 +47,7 @@ int export_xml(struct channel_t *channel, struct user_t *users) { for(int h = 0; h < 24; h++) { xmlNodePtr hour_node = xmlNewChild(lines_node, NULL, "hour", NULL); for(int q = 0; q < 4; q++) { - sprintf(s, "%d", user->lines[h*4 + q]); + snprintf(s, 0xf, "%d", user->lines[h*4 + q]); xmlNewChild(hour_node, NULL, "quarter", s); } } @@ -64,7 +64,7 @@ int export_xml(struct channel_t *channel, struct user_t *users) { xmlNodePtr word_node = xmlNewChild(words_node, NULL, "word", NULL); xmlNewChild(word_node, NULL, "name", word->name); - sprintf(s, "%d", word->count); + snprintf(s, 0xf, "%d", word->count); xmlNewChild(word_node, NULL, "count", s); word = word->next; -- cgit v1.2.3