summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYaniv Kaul <ykaul@redhat.com>2020-01-14 16:55:32 +0200
committerAmar Tumballi <amarts@gmail.com>2020-01-19 16:37:00 +0000
commitc7b546326092d060bf84b7c578a4f21bc679674a (patch)
tree7716fd5f0764abc45e7e23faa999b86551be3452
parent485212e858bddd97573a3b2b811357b0d822005a (diff)
name.c: fix Coverity issues 1412332/3 - strcat into uninitialized value
Check limit to 108 bytes before strcpy(). fixes: CID#1412332 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com> Change-Id: I8b26b1e1d2daca98ff36db531539bec0a405769c
-rw-r--r--rpc/rpc-transport/socket/src/name.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/rpc/rpc-transport/socket/src/name.c b/rpc/rpc-transport/socket/src/name.c
index e374de6..9286bbb 100644
--- a/rpc/rpc-transport/socket/src/name.c
+++ b/rpc/rpc-transport/socket/src/name.c
@@ -108,7 +108,7 @@ af_unix_client_bind(rpc_transport_t *this, struct sockaddr *sockaddr,
path_data = dict_get_sizen(this->options, "transport.socket.bind-path");
if (path_data) {
char *path = data_to_str(path_data);
- if (!path || path_data->len > UNIX_PATH_MAX) {
+ if (!path || path_data->len > 108) { /* 108 = addr->sun_path length */
gf_log(this->name, GF_LOG_TRACE,
"bind-path not specified for unix socket, "
"letting connect to assign default value");
@@ -292,7 +292,8 @@ af_unix_client_get_remote_sockaddr(rpc_transport_t *this,
goto err;
}
- if ((connect_path_data->len + 1) > UNIX_PATH_MAX) {
+ /* 108 = sockaddr_un->sun_path length */
+ if ((connect_path_data->len + 1) > 108) {
gf_log(this->name, GF_LOG_ERROR,
"connect-path value length %d > %d octets",
connect_path_data->len + 1, UNIX_PATH_MAX);