aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2015-06-17 10:13:40 +0100
committerPeter Maydell <peter.maydell@linaro.org>2015-06-17 10:13:40 +0100
commit8c29f8d6b9595ac0f9ab1b41f22e91aebab482d7 (patch)
tree7fe882b28651b57e1b2acd8e84b11cd5b453453c
parent93f6d1c16036aaf34055d16f54ea770fb8d6d280 (diff)
parentf8d30a4f96d6c3a12e692d2e69b8fe4734b916c6 (diff)
Merge remote-tracking branch 'remotes/kvaneesh/tags/for-upstream-signed' into staging
VirtFS update: * Fix for virtfs-proxy-helper crash * Gracefully handle the error condition on input validation in virtfs-proxy-helper # gpg: Signature made Tue Jun 16 16:21:28 2015 BST using RSA key ID 04C4E23A # gpg: Good signature from "Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>" # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 4846 9DE7 1860 360F A6E9 968C DE41 A4FE 04C4 E23A * remotes/kvaneesh/tags/for-upstream-signed: virtfs-proxy-helper: fail gracefully if socket path is too long virtfs-proxy-helper: add missing long option terminator Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--fsdev/virtfs-proxy-helper.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/fsdev/virtfs-proxy-helper.c b/fsdev/virtfs-proxy-helper.c
index a698e2dbb3..9097d15c98 100644
--- a/fsdev/virtfs-proxy-helper.c
+++ b/fsdev/virtfs-proxy-helper.c
@@ -49,6 +49,7 @@ static struct option helper_opts[] = {
{"socket", required_argument, NULL, 's'},
{"uid", required_argument, NULL, 'u'},
{"gid", required_argument, NULL, 'g'},
+ {},
};
static bool is_daemon;
@@ -738,7 +739,12 @@ static int proxy_socket(const char *path, uid_t uid, gid_t gid)
return -1;
}
- g_assert(strlen(path) < sizeof(proxy.sun_path));
+ if (strlen(path) >= sizeof(proxy.sun_path)) {
+ do_log(LOG_CRIT, "UNIX domain socket path exceeds %zu characters\n",
+ sizeof(proxy.sun_path));
+ return -1;
+ }
+
sock = socket(AF_UNIX, SOCK_STREAM, 0);
if (sock < 0) {
do_perror("socket");