diff mbox

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

Message ID 20180605153034.49074-2-steved@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Steve Dickson June 5, 2018, 3:30 p.m. UTC
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@redhat.com>
---
 support/nfsidmap/umich_ldap.c | 4 ++--
 utils/idmapd/idmapd.c         | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

Comments

Steve Dickson June 5, 2018, 5:22 p.m. UTC | #1
On 06/05/2018 11:30 AM, Steve Dickson wrote:
> 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@redhat.com>
Committed... 

steved.

> ---
>  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);
>  
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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);