Module: kamailio
Branch: master
Commit: b2267fd5d2825214ae9be5217514547e60e6c0f3
URL:
https://github.com/kamailio/kamailio/commit/b2267fd5d2825214ae9be5217514547…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2019-12-02T16:25:44+01:00
jsonrpcc: use snprintf() instead of sprintf()
---
Modified: src/modules/jsonrpcc/netstring.c
---
Diff:
https://github.com/kamailio/kamailio/commit/b2267fd5d2825214ae9be5217514547…
Patch:
https://github.com/kamailio/kamailio/commit/b2267fd5d2825214ae9be5217514547…
---
diff --git a/src/modules/jsonrpcc/netstring.c b/src/modules/jsonrpcc/netstring.c
index 4dbc651630..43a7486987 100644
--- a/src/modules/jsonrpcc/netstring.c
+++ b/src/modules/jsonrpcc/netstring.c
@@ -185,7 +185,7 @@ size_t netstring_encode_new(char **netstring, char *data, size_t len)
{
LM_ERR("Out of memory!");
return 0;
}
- sprintf(ns, "%lu:", (unsigned long)len);
+ snprintf(ns, num_len + len + 2, "%lu:", (unsigned long)len);
memcpy(ns + num_len + 1, data, len);
ns[num_len + len + 1] = ',';
}