887953
From 7eeba48a6aa2bb04b40163849f211f068a8e6452 Mon Sep 17 00:00:00 2001
887953
From: Amar Tumballi <amarts@redhat.com>
887953
Date: Tue, 2 Oct 2018 13:27:20 +0530
887953
Subject: [PATCH 388/399] glusterd-handshake: prevent a buffer overflow
887953
887953
as key size in xdr can be anything, it can be bigger than the
887953
'NAME_MAX' allowed in the structure, which can allow for service denial
887953
attacks.
887953
887953
Fixes: CVE-2018-14653
887953
BUG: 1634668
887953
Change-Id: I207db66e0bd1959aad7ca40040cc66b9fc81e111
887953
Signed-off-by: Amar Tumballi <amarts@redhat.com>
887953
Reviewed-on: https://code.engineering.redhat.com/gerrit/151515
887953
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
887953
---
887953
 xlators/mgmt/glusterd/src/glusterd-handshake.c | 6 ++++++
887953
 1 file changed, 6 insertions(+)
887953
887953
diff --git a/xlators/mgmt/glusterd/src/glusterd-handshake.c b/xlators/mgmt/glusterd/src/glusterd-handshake.c
887953
index 3d1dfb2..d5594d0 100644
887953
--- a/xlators/mgmt/glusterd/src/glusterd-handshake.c
887953
+++ b/xlators/mgmt/glusterd/src/glusterd-handshake.c
887953
@@ -847,6 +847,12 @@ __server_getspec (rpcsvc_request_t *req)
887953
 
887953
         volume = args.key;
887953
 
887953
+        if (strlen (volume) >= (NAME_MAX)) {
887953
+                op_errno = EINVAL;
887953
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL, GD_MSG_NAME_TOO_LONG,
887953
+                        "volume name too long (%s)", volume);
887953
+                goto fail;
887953
+        }
887953
         /* Need to strip leading '/' from volnames. This was introduced to
887953
          * support nfs style mount parameters for native gluster mount
887953
          */
887953
-- 
887953
1.8.3.1
887953