diff options
Diffstat (limited to 'rpc/rpc-transport/rdma/src/rdma.c')
-rw-r--r-- | rpc/rpc-transport/rdma/src/rdma.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/rpc/rpc-transport/rdma/src/rdma.c b/rpc/rpc-transport/rdma/src/rdma.c index ac984c16924..edf4e13bd48 100644 --- a/rpc/rpc-transport/rdma/src/rdma.c +++ b/rpc/rpc-transport/rdma/src/rdma.c @@ -4489,7 +4489,12 @@ gf_rdma_listen(rpc_transport_t *this) goto err; } - sprintf(this->myinfo.identifier, "%s:%s", host, service); + if (snprintf(this->myinfo.identifier, UNIX_PATH_MAX, "%s:%s", host, + service) >= UNIX_PATH_MAX) { + gf_msg(this->name, GF_LOG_WARNING, 0, RDMA_MSG_BUFFER_ERROR, + "host and service name too large"); + goto err; + } ret = rdma_set_option(peer->cm_id, RDMA_OPTION_ID, RDMA_OPTION_ID_REUSEADDR, (void *)&optval, sizeof(optval)); |