[Tarantool-patches] [PATCH 1/2] raft: raft_request_to_string -- don't hardcode size
Cyrill Gorcunov
gorcunov at gmail.com
Wed Oct 14 17:26:16 MSK 2020
The size should be matched to the real size of a buffer,
otherwise it is a room for mistake.
Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
---
src/box/raft.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/box/raft.c b/src/box/raft.c
index 0b6c373e8..9de77b0ec 100644
--- a/src/box/raft.c
+++ b/src/box/raft.c
@@ -268,8 +268,8 @@ static const char *
raft_request_to_string(const struct raft_request *req)
{
assert(req->term != 0);
- int size = 1024;
char buf[1024];
+ int size = sizeof(buf);
char *pos = buf;
int rc = snprintf(pos, size, "{term: %llu",
(unsigned long long)req->term);
--
2.26.2
More information about the Tarantool-patches
mailing list