Fix strict strncpy compiler warnings when building in BlueZ
cover Fix strict strncpy compiler warnings when building in BlueZ
Fixes two new strict compiler warnings in bluez for strncpy
Brian Gix (2):
dbus: fix strict compiler warnings for strncpy
log: Fix strict compiler warning for strncpy
ell/dbus.c | 4 ++-- ell/log.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
Signature · 1 line
2.17.2
PATCH 1/2 dbus: fix strict compiler warnings for strncpy
--- ell/dbus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
ell/dbus.c +2 -2
@@ -1128,7 +1128,7 @@ static struct l_dbus *setup_unix(char *params) } addr.sun_path[0 ] ='\0' ; -strncpy (addr.sun_path +1 , path, len); +strncpy (addr.sun_path +1 , path,sizeof (addr.sun_path) -2 ); len++; }else {if (len >sizeof (addr.sun_path)) {
@@ -1136,7 +1136,7 @@ static struct l_dbus *setup_unix(char *params)return NULL ; } -strncpy (addr.sun_path, path, len); +strncpy (addr.sun_path, path,sizeof (addr.sun_path) -1 ); } if (connect(fd, (struct sockaddr *) &addr,
Signature · 1 line
2.17.2
PATCH 2/2 log: Fix strict compiler warning for strncpy
In reply to Brian Gix--- ell/log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
ell/log.c +1 -1
@@ -86,7 +86,7 @@ static int open_log(const char *path)memset (&addr,0 ,sizeof (addr)); addr.sun_family =AF_UNIX ; -strncpy (addr.sun_path, path,sizeof (addr.sun_path)); +strncpy (addr.sun_path, path,sizeof (addr.sun_path) -1 );if (connect (log_fd, (struct sockaddr *) &addr,sizeof (addr)) <0 ) {close_log ();
Signature · 1 line
2.17.2
Hi Brian,
Quoted 9 lines
Fixes two new strict compiler warnings in bluez for strncpy
Brian Gix (2):
dbus: fix strict compiler warnings for strncpy
log: Fix strict compiler warning for strncpy
ell/dbus.c| 4 ++--ell/log.c| 2 +-2 files changed, 3 insertions(+), 3 deletions(-)
both patches have been applied.
Regards
Marcel