All of lore.kernel.org
 help / color / mirror / Atom feed
From: PRAMOD DEVENDRA <pramod.devendra@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Ian Jackson <ian.jackson@eu.citrix.com>,
	Wei Liu <wei.liu2@citrix.com>,
	Pramod Devendra <pramod.devendra@citrix.com>,
	Ian Campbell <ian.campbell@citrix.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: [PATCH 1/3] tools/libxl/libxl_qmp.c: Make sure sun_path is NULL terminated in qmp_open
Date: Mon, 16 Mar 2015 10:05:38 +0000	[thread overview]
Message-ID: <1426500338-36798-1-git-send-email-pramod.devendra@citrix.com> (raw)

From: Pramod Devendra <pramod.devendra@citrix.com>

Signed-off-by: Pramod Devendra <pramod.devendra@citrix.com>
CC: Ian Jackson <ian.jackson@eu.citrix.com>
CC: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
CC: Ian Campbell <ian.campbell@citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
---
 tools/libxl/libxl_qmp.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/libxl/libxl_qmp.c b/tools/libxl/libxl_qmp.c
index c7324e6..1080162 100644
--- a/tools/libxl/libxl_qmp.c
+++ b/tools/libxl/libxl_qmp.c
@@ -369,10 +369,13 @@ static int qmp_open(libxl__qmp_handler *qmp, const char *qmp_socket_path,
     ret = libxl_fd_set_cloexec(qmp->ctx, qmp->qmp_fd, 1);
     if (ret) return -1;
 
+    if(sizeof (qmp->addr.sun_path) <= strlen(qmp_socket_path))
+        return -1;
+
     memset(&qmp->addr, 0, sizeof (qmp->addr));
     qmp->addr.sun_family = AF_UNIX;
     strncpy(qmp->addr.sun_path, qmp_socket_path,
-            sizeof (qmp->addr.sun_path));
+            sizeof (qmp->addr.sun_path)-1);
 
     do {
         ret = connect(qmp->qmp_fd, (struct sockaddr *) &qmp->addr,
-- 
1.7.10.4

             reply	other threads:[~2015-03-16 10:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-16 10:05 PRAMOD DEVENDRA [this message]
2015-03-17 15:42 ` [PATCH 1/3] tools/libxl/libxl_qmp.c: Make sure sun_path is NULL terminated in qmp_open Wei Liu
2015-03-18 10:04 ` Ian Campbell
2015-03-19  6:40 ` [PATCH v2] libxl/libxl_qmp.c: fix qmp_open PRAMOD DEVENDRA
2015-03-19 10:03   ` Wei Liu
2015-03-19 10:51     ` Ian Campbell
2015-03-19 12:55   ` [PATCH v3] libxl/libxl_qmp.c: fix error handling in qmp_open PRAMOD DEVENDRA
2015-03-20 10:08     ` Wei Liu
2015-03-20 11:56       ` Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1426500338-36798-1-git-send-email-pramod.devendra@citrix.com \
    --to=pramod.devendra@citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.