]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
Don't use initialized garbage for address lengths
authorSteve Dickson <steved@redhat.com>
Wed, 15 Jul 2009 10:21:54 +0000 (06:21 -0400)
committerSteve Dickson <steved@redhat.com>
Wed, 15 Jul 2009 10:21:54 +0000 (06:21 -0400)
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 <steved@redhat.com>
utils/mount/stropts.c

index 9d82bb141d37fbea3052c5ee02b0c5eb9cc6d75f..a12ace7f9f480cd42863843bb32c51f8aaaa4b20 100644 (file)
@@ -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;