summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlfred E. Heggestad <alfred.heggestad@gmail.com>2018-01-29 17:45:11 +0100
committerAlfred E. Heggestad <alfred.heggestad@gmail.com>2018-01-29 17:45:11 +0100
commitd79d6c83f8548de0d05baa2ab4bcb9d1ccdc20f2 (patch)
treea84281802eebc2096f579d6298e345bb34b24bf3
parent376796ffe68fb078c77ee7da435acb23fa6a3b3d (diff)
ctrl_tcp: use re_snprintf, fix warning
-rw-r--r--modules/ctrl_tcp/tcp_netstring.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/ctrl_tcp/tcp_netstring.c b/modules/ctrl_tcp/tcp_netstring.c
index 7b025fd..2ad4742 100644
--- a/modules/ctrl_tcp/tcp_netstring.c
+++ b/modules/ctrl_tcp/tcp_netstring.c
@@ -42,7 +42,7 @@ static bool netstring_send_handler(int *err, struct mbuf *mb, void *arg)
{
struct netstring *netstring = arg;
size_t num_len;
- char num_str[10];
+ char num_str[32];
if (mb->pos < NETSTRING_HEADER_SIZE) {
DEBUG_WARNING("send: not enough space for netstring header\n");
@@ -67,7 +67,7 @@ static bool netstring_send_handler(int *err, struct mbuf *mb, void *arg)
return false;
}
- sprintf(num_str, "%zu", mbuf_get_left(mb));
+ re_snprintf(num_str, sizeof(num_str), "%zu", mbuf_get_left(mb));
num_len = strlen(num_str);
mb->pos = NETSTRING_HEADER_SIZE - (num_len + 1);