You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ja...@apache.org on 2022/06/28 08:57:14 UTC
[mynewt-core] branch master updated: net/ip/native_socks: Fix build on with -Werror=stringop-overflow
This is an automated email from the ASF dual-hosted git repository.
janc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
The following commit(s) were added to refs/heads/master by this push:
new e666bdfe9 net/ip/native_socks: Fix build on with -Werror=stringop-overflow
e666bdfe9 is described below
commit e666bdfe9b7e67ab3f393ae4389baf5db0e77279
Author: Szymon Janc <sz...@codecoup.pl>
AuthorDate: Mon Jun 27 17:54:20 2022 +0200
net/ip/native_socks: Fix build on with -Werror=stringop-overflow
Werror=stringop-overflow= seems to be now enabled by default on GCC 11.
repos/apache-mynewt-core/net/ip/native_sockets/src/native_sock.c: In
function ‘native_sock_mn_addr_to_addr’:
repos/apache-mynewt-core/net/ip/native_sockets/src/native_sock.c:199:9:
error: ‘strncat’ specified bound 108 equals destination size
[-Werror=stringop-overflow=]
199 | strncat(sun->sun_path, msun->msun_path,
sizeof sun->sun_path);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
---
net/ip/native_sockets/src/native_sock.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ip/native_sockets/src/native_sock.c b/net/ip/native_sockets/src/native_sock.c
index 5fbf0d1ba..71ad0486b 100644
--- a/net/ip/native_sockets/src/native_sock.c
+++ b/net/ip/native_sockets/src/native_sock.c
@@ -196,7 +196,7 @@ native_sock_mn_addr_to_addr(struct mn_sockaddr *ms, struct sockaddr *sa,
sun->sun_len = sizeof(*sun);
#endif
sun->sun_path[0] = '\0';
- strncat(sun->sun_path, msun->msun_path, sizeof sun->sun_path);
+ strncat(sun->sun_path, msun->msun_path, sizeof(sun->sun_path) - 1);
if (strcmp(sun->sun_path, msun->msun_path) != 0) {
/* Path too long. */
return MN_EINVAL;