Anton Blanchard
2013-Dec-03 07:14 UTC
[klibc] [PATCH] 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> --- 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"); -- 1.8.3.2