Copy into fixed size buffer

Signed-off-by: Donghwa Jeong <dh48.jeong@samsung.com>
This commit is contained in:
Donghwa Jeong 2018-06-08 21:37:48 +09:00
parent 21e20322cf
commit 98c7c8eb1f
No known key found for this signature in database
GPG Key ID: 0BE2750EE612F372

View File

@ -319,7 +319,7 @@ static int lxc_abstract_unix_connect(const char *path)
return -1; return -1;
} }
/* addr.sun_path[0] has already been set to 0 by memset() */ /* addr.sun_path[0] has already been set to 0 by memset() */
memcpy(&addr.sun_path[1], &path[1], strlen(&path[1])); memcpy(&addr.sun_path[1], &path[1], len);
ret = connect(fd, (struct sockaddr *)&addr, ret = connect(fd, (struct sockaddr *)&addr,
offsetof(struct sockaddr_un, sun_path) + len + 1); offsetof(struct sockaddr_un, sun_path) + len + 1);