From f3132b97df6cb22d7fe6ba4d26e119200a3b70d6 Mon Sep 17 00:00:00 2001 From: Prasanna Kumar Kalever Date: Wed, 15 Feb 2017 23:30:15 +0530 Subject: daemon: fix minor bugs Reported-by: Pranith Kumar K Signed-off-by: Prasanna Kumar Kalever --- cli/gluster-block.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'cli') 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)); -- cgit