From: Steve Dickson Date: Wed, 15 Jul 2009 10:21:54 +0000 (-0400) Subject: Don't use initialized garbage for address lengths X-Git-Tag: nfs-utils-1-2-1-rc2~1 X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=b46dc42505da799a05a3a5e8f004b308f6b9eef7;p=nfs-utils.git 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 --- 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;