From b46dc42505da799a05a3a5e8f004b308f6b9eef7 Mon Sep 17 00:00:00 2001 From: Steve Dickson Date: Wed, 15 Jul 2009 06:21:54 -0400 Subject: [PATCH] Don't use initialized garbage for address lengths Make sure address lengths are initialized before call calling nfs_extract_server_addresses() from nfs_rewrite_pmap_mount_options(). Otherwise the length check in nfs_string_to_sockaddr() can fail since its will be using garbage from the stack. Signed-off-by: Steve Dickson --- utils/mount/stropts.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c index 9d82bb1..a12ace7 100644 --- a/utils/mount/stropts.c +++ b/utils/mount/stropts.c @@ -420,11 +420,11 @@ nfs_rewrite_pmap_mount_options(struct mount_options *options) { struct sockaddr_storage nfs_address; struct sockaddr *nfs_saddr = (struct sockaddr *)&nfs_address; - socklen_t nfs_salen; + socklen_t nfs_salen = sizeof(nfs_address); struct pmap nfs_pmap; struct sockaddr_storage mnt_address; struct sockaddr *mnt_saddr = (struct sockaddr *)&mnt_address; - socklen_t mnt_salen; + socklen_t mnt_salen = sizeof(mnt_address); struct pmap mnt_pmap; char *option; -- 2.39.5