[PATCH 2/2] Remove a number of stringop-overflow warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



umich_ldap.c:1128:3: warning: ‘strncat’ specified bound 128
	equals destination size [-Wstringop-overflow=]

umich_ldap.c:1130:3: warning: ‘strncat’ specified bound 128
	equals destination size [-Wstringop-overflow=]

idmapd.c:313:2: warning: ‘strncat’ specified bound 4096
	equals destination size [-Wstringop-overflow=]

Signed-off-by: Steve Dickson <steved@xxxxxxxxxx>
---
 support/nfsidmap/umich_ldap.c | 4 ++--
 utils/idmapd/idmapd.c         | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/support/nfsidmap/umich_ldap.c b/support/nfsidmap/umich_ldap.c
index 0e31b1c..b661110 100644
--- a/support/nfsidmap/umich_ldap.c
+++ b/support/nfsidmap/umich_ldap.c
@@ -1125,9 +1125,9 @@ umichldap_init(void)
 
 	/* Verify required information is supplied */
 	if (server_in == NULL || strlen(server_in) == 0)
-		strncat(missing_msg, "LDAP_server ", sizeof(missing_msg));
+		strncat(missing_msg, "LDAP_server ", sizeof(missing_msg)-1);
 	if (ldap_info.base == NULL || strlen(ldap_info.base) == 0)
-		strncat(missing_msg, "LDAP_base ", sizeof(missing_msg));
+		strncat(missing_msg, "LDAP_base ", sizeof(missing_msg)-1);
 	if (strlen(missing_msg) != 0) {
 		IDMAP_LOG(0, ("umichldap_init: Missing required information: "
 			  "%s", missing_msg));
diff --git a/utils/idmapd/idmapd.c b/utils/idmapd/idmapd.c
index 2585fb2..4811e0f 100644
--- a/utils/idmapd/idmapd.c
+++ b/utils/idmapd/idmapd.c
@@ -310,7 +310,7 @@ main(int argc, char **argv)
 	if (!serverstart && !clientstart)
 		errx(1, "it is illegal to specify both -C and -S");
 
-	strncat(pipefsdir, "/nfs", sizeof(pipefsdir));
+	strncat(pipefsdir, "/nfs", sizeof(pipefsdir)-1);
 
 	daemon_init(fg);
 
-- 
2.17.1

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux