diff options
author | Prasanna Kumar Kalever <prasanna.kalever@redhat.com> | 2017-02-15 23:30:15 +0530 |
---|---|---|
committer | Prasanna Kumar Kalever <prasanna.kalever@redhat.com> | 2017-02-16 19:49:34 +0530 |
commit | f3132b97df6cb22d7fe6ba4d26e119200a3b70d6 (patch) | |
tree | 82fe98b99b92518ffdc62003d446d131eb607f4d /cli | |
parent | ff8c74670559f153b3f084fd67bba0eb03b07e7c (diff) |
daemon: fix minor bugs
Reported-by: Pranith Kumar K <pkarampu@redhat.com>
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
Diffstat (limited to 'cli')
-rw-r--r-- | cli/gluster-block.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/cli/gluster-block.c b/cli/gluster-block.c index d2ad4c2..8b6836b 100644 --- a/cli/gluster-block.c +++ b/cli/gluster-block.c @@ -37,8 +37,8 @@ glusterBlockCliRPC_1(void *cobj, clioperations opt, char **out) { CLIENT *clnt = NULL; int ret = -1; - int sockfd; - struct sockaddr_un saun; + int sockfd = -1; + struct sockaddr_un saun = {0,}; blockCreateCli *create_obj; blockDeleteCli *delete_obj; blockInfoCli *info_obj; @@ -46,6 +46,13 @@ glusterBlockCliRPC_1(void *cobj, clioperations opt, char **out) blockResponse *reply = NULL; + if (strlen(GB_UNIX_ADDRESS) > SUN_PATH_MAX) { + LOG("cli", GB_LOG_ERROR, + "%s: path length is more than SUN_PATH_MAX: (%zu > %zu chars)", + GB_UNIX_ADDRESS, strlen(GB_UNIX_ADDRESS), SUN_PATH_MAX); + goto out; + } + if ((sockfd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) { LOG("cli", GB_LOG_ERROR, "%s: socket creation failed (%s)", GB_UNIX_ADDRESS, strerror (errno)); |