1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

ctdb: Fix CID 1327222 Copy into fixed size buffer

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>

Autobuild-User(master): Uri Simchoni <uri@samba.org>
Autobuild-Date(master): Tue May 17 21:21:30 CEST 2016 on sn-devel-144
This commit is contained in:
Volker Lendecke 2016-05-17 11:39:38 +02:00 committed by Uri Simchoni
parent 04b5e9c9a6
commit 84aea20f37

View File

@ -2097,11 +2097,17 @@ static bool server_recv(struct tevent_req *req, int *perr)
static int socket_init(const char *sockpath)
{
struct sockaddr_un addr;
size_t len;
int ret, fd;
memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_UNIX;
strcpy(addr.sun_path, sockpath);
len = strlcpy(addr.sun_path, sockpath, sizeof(addr.sun_path));
if (len >= sizeof(addr.sun_path)) {
fprintf(stderr, "path too long: %s\n", sockpath);
return -1;
}
fd = socket(AF_UNIX, SOCK_STREAM, 0);
if (fd == -1) {