mirror of
https://github.com/X11Libre/xf86-video-intel.git
synced 2026-03-24 01:24:12 +00:00
intel-virtual-output: Fix invocation of strncpy()
Somebody (me) confused it with snprintf() and put the string length in the wrong location. Also note that strncpy() does not NUL terminate long strings. Reported-by: Zdenek Kabelac <zdenek.kabelac@gmail.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
@@ -2387,8 +2387,10 @@ static int bumblebee_open(struct context *ctx)
|
||||
}
|
||||
|
||||
addr.sun_family = AF_UNIX;
|
||||
strncpy(addr.sun_path, sizeof(addr.sun_path),
|
||||
optarg && *optarg ? optarg : "/var/run/bumblebee.socket");
|
||||
strncpy(addr.sun_path,
|
||||
optarg && *optarg ? optarg : "/var/run/bumblebee.socket",
|
||||
sizeof(addr.sun_path)-1);
|
||||
addr.sun_path[sizeof(addr.sun_path)-1] = '\0';
|
||||
if (connect(fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
|
||||
DBG(X11, ("%s unable to create a socket: %d\n", __func__, errno));
|
||||
goto err;
|
||||
|
||||
Reference in New Issue
Block a user