[klibc] [klibc:master] nfsmount: memset uses sizeof pointer as length

klibc-bot for Anton Blanchard anton at samba.org
Tue Dec 3 10:57:06 PST 2013


Commit-ID:  71a849a7e2d5e73321e986fa91d1f34b387e71ba
Gitweb:     http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=71a849a7e2d5e73321e986fa91d1f34b387e71ba
Author:     Anton Blanchard <anton at samba.org>
AuthorDate: Tue, 3 Dec 2013 18:14:58 +1100
Committer:  H. Peter Anvin <hpa at zytor.com>
CommitDate: Tue, 3 Dec 2013 10:53:38 -0800

[klibc] nfsmount: memset uses sizeof pointer as length

gcc picked up a couple of suspicious memset lengths which turned
out to be real bugs.

Signed-off-by: Anton Blanchard <anton at samba.org>
Signed-off-by: H. Peter Anvin <hpa at zytor.com>

---
 usr/kinit/nfsmount/sunrpc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/usr/kinit/nfsmount/sunrpc.c b/usr/kinit/nfsmount/sunrpc.c
index 0628cef..0a7fcf5 100644
--- a/usr/kinit/nfsmount/sunrpc.c
+++ b/usr/kinit/nfsmount/sunrpc.c
@@ -149,7 +149,7 @@ struct client *tcp_client(uint32_t server, uint16_t port, uint32_t flags)
 		goto bail;
 	}
 
-	memset(clnt, 0, sizeof(clnt));
+	memset(clnt, 0, sizeof(*clnt));
 
 	if ((sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1) {
 		perror("socket");
@@ -194,7 +194,7 @@ struct client *udp_client(uint32_t server, uint16_t port, uint32_t flags)
 		goto bail;
 	}
 
-	memset(clnt, 0, sizeof(clnt));
+	memset(clnt, 0, sizeof(*clnt));
 
 	if ((sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1) {
 		perror("socket");


More information about the klibc mailing list