From d4b8825436daad701995e120f38da706e5fe97c1 Mon Sep 17 00:00:00 2001 From: Krishnan Parthasarathi Date: Tue, 24 Dec 2013 17:58:21 +0530 Subject: socket: unix socket connect path can't be greater than UNIX_PATH_MAX characters Change-Id: I74788b63dd1c14507aa6d65182ea4b87a2e1f389 BUG: 1046308 Signed-off-by: Krishnan Parthasarathi Reviewed-on: http://review.gluster.org/6589 Tested-by: Gluster Build System Reviewed-by: Vijaikumar Mallikarjuna Reviewed-by: Vijay Bellur --- rpc/rpc-transport/socket/src/name.c | 4 ++-- tests/bugs/bug-1046308.t | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 tests/bugs/bug-1046308.t diff --git a/rpc/rpc-transport/socket/src/name.c b/rpc/rpc-transport/socket/src/name.c index 1647d5b6b..c6eae9739 100644 --- a/rpc/rpc-transport/socket/src/name.c +++ b/rpc/rpc-transport/socket/src/name.c @@ -285,7 +285,7 @@ af_unix_client_get_remote_sockaddr (rpc_transport_t *this, goto err; } - if (strlen (connect_path) > UNIX_PATH_MAX) { + if ((strlen (connect_path) + 1) > UNIX_PATH_MAX) { gf_log (this->name, GF_LOG_ERROR, "connect-path value length %"GF_PRI_SIZET" > %d octets", strlen (connect_path), UNIX_PATH_MAX); @@ -329,7 +329,7 @@ af_unix_server_get_local_sockaddr (rpc_transport_t *this, #define UNIX_PATH_MAX 108 #endif - if (strlen (listen_path) > UNIX_PATH_MAX) { + if ((strlen (listen_path) + 1) > UNIX_PATH_MAX) { gf_log (this->name, GF_LOG_ERROR, "option transport.unix.listen-path has value length " "%"GF_PRI_SIZET" > %d", diff --git a/tests/bugs/bug-1046308.t b/tests/bugs/bug-1046308.t new file mode 100644 index 000000000..cfec3a35d --- /dev/null +++ b/tests/bugs/bug-1046308.t @@ -0,0 +1,19 @@ +#!/bin/bash + +. $(dirname $0)/../include.rc + +cleanup; + +volname="StartMigrationDuringRebalanceTest" +TEST glusterd +TEST pidof glusterd; + +TEST $CLI volume info; +TEST $CLI volume create $volname $H0:$B0/${volname}{1,2}; +TEST $CLI volume start $volname; +TEST $CLI volume rebalance $volname start; + +cleanup; + + + -- cgit