bs_sheepdog.c: fix an unsafe strncpy() call
PATCH 1/1 bs_sheepdog.c: fix an unsafe strncpy() call
The strncpy() call doesn't take a null terminator into account. On some environment, it conflicts with __builtin___strncpy_chk() and gcc warns.
Signed-off-by Hitoshi Mitake <[email protected]>
--- usr/bs_sheepdog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
usr/bs_sheepdog.c +1 -1
@@ -398,7 +398,7 @@ static int connect_to_sdog_unix(const char *path)memset (&un,0 ,sizeof (un)); un.sun_family =AF_UNIX ; -strncpy (un.sun_path, path,UNIX_PATH_MAX ); +strncpy (un.sun_path, path,UNIX_PATH_MAX -1 ); ret =connect (fd, (const struct sockaddr *)&un, (socklen_t )sizeof (un));if (ret <0 ) {
Signature · 1 line
1.8.1.2
FUJITA Tomonori
AppliedQuoted 8 lines · On Sun, 24 Nov 2013 23:18:09 +0900 Hitoshi Mitake <[email protected]>…
The
strncpy()call doesn't take a null terminator into account. On some environment, it conflicts with__builtin___strncpy_chk()and gcc warns.Signed-off-by Hitoshi Mitake <[email protected]>--- usr/bs_sheepdog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Applied, thanks.