summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorAlfred E. Heggestad <alfred.heggestad@gmail.com>2018-01-29 18:08:45 +0100
committerAlfred E. Heggestad <alfred.heggestad@gmail.com>2018-01-29 18:08:45 +0100
commitb74fd8b108929fb41fde4085fc780b95c0982fc0 (patch)
treeb31037378b15dec90f1685527d2f2e8519a9081e /modules
parent00252b48ee28483ad9d8f9edb43e0062b9951f84 (diff)
ctrl_tcp: using sprintf is not safe, use re_snprintf instead
Diffstat (limited to 'modules')
-rw-r--r--modules/ctrl_tcp/netstring/netstring.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/modules/ctrl_tcp/netstring/netstring.c b/modules/ctrl_tcp/netstring/netstring.c
index d429791..0309872 100644
--- a/modules/ctrl_tcp/netstring/netstring.c
+++ b/modules/ctrl_tcp/netstring/netstring.c
@@ -5,6 +5,7 @@
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
+#include <re.h>
#include "netstring.h"
@@ -114,9 +115,9 @@ int netstring_read(char *buffer, size_t buffer_length,
*/
size_t netstring_num_len(size_t num)
{
- char num_str[10];
+ char num_str[32];
- sprintf(num_str, "%zu", num);
+ re_snprintf(num_str, sizeof(num_str), "%zu", num);
return strlen(num_str);
}