summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-08-26 12:42:11 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2014-08-26 12:46:41 +0100
commite827f80e5c07ac13802a24753b249e05e18a290e (patch)
tree6ee2fb291be37dc4b68c99e8f16ce6d2f829530c
parent51037706b068b52b7c8984527c209d295e1e3584 (diff)
intel-virtual-output: Sanity check length on user supplied socket path
Reported-by: Zdenek Kabelac <zkabelac@redhat.com> Suggested-by: Zdenek Kabelac <zkabelac@redhat.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--tools/virtual.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/virtual.c b/tools/virtual.c
index 83b934aa..9b1912f8 100644
--- a/tools/virtual.c
+++ b/tools/virtual.c
@@ -2387,7 +2387,8 @@ static int bumblebee_open(struct context *ctx)
}
addr.sun_family = AF_UNIX;
- strcpy(addr.sun_path, optarg && *optarg ? optarg : "/var/run/bumblebee.socket");
+ strncpy(addr.sun_path, sizeof(addr.sun_path),
+ optarg && *optarg ? optarg : "/var/run/bumblebee.socket");
if (connect(fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
DBG(X11, ("%s unable to create a socket: %d\n", __func__, errno));
goto err;