Skip to content

Commit

Permalink
coverity: #1425893
Browse files Browse the repository at this point in the history
used calculated string length when copying into buffer

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Dec 17, 2017
1 parent b79cc66 commit 69e930b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lxc/af_unix.c
Expand Up @@ -62,7 +62,7 @@ int lxc_abstract_unix_open(const char *path, int type, int flags)
return -1;
}
/* addr.sun_path[0] has already been set to 0 by memset() */
strncpy(&addr.sun_path[1], &path[1], strlen(&path[1]));
strncpy(&addr.sun_path[1], &path[1], len);

ret = bind(fd, (struct sockaddr *)&addr,
offsetof(struct sockaddr_un, sun_path) + len + 1);
Expand Down

0 comments on commit 69e930b

Please sign in to comment.