summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorSummerGift <[email protected]>2017-12-23 11:57:30 +0800
committerSummerGift <[email protected]>2017-12-23 11:58:23 +0800
commit98d8145661e4da09eb0f9c40a3cb96590a373115 (patch)
tree3af673a9958f76ae7c8f6e225de35902b2715211 /components
parent9644678dcbc0cfb52d1fdcc8817730edba11afc6 (diff)
[nfs] : fix bug in nfs when enable ipv6
Diffstat (limited to 'components')
-rw-r--r--components/dfs/filesystems/nfs/rpc/clnt_generic.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/components/dfs/filesystems/nfs/rpc/clnt_generic.c b/components/dfs/filesystems/nfs/rpc/clnt_generic.c
index dcc2eb2097..683b2fe42e 100644
--- a/components/dfs/filesystems/nfs/rpc/clnt_generic.c
+++ b/components/dfs/filesystems/nfs/rpc/clnt_generic.c
@@ -62,7 +62,15 @@ CLIENT *clnt_create (const char *hostname, const unsigned long prog,
memset((char*)&sin,0,sizeof(sin));
sin.sin_family = h->h_addrtype;
sin.sin_port = 0;
- memmove((char *) &sin.sin_addr, h->h_addr, h->h_length);
+
+ if (h->h_addrtype == AF_INET)
+ {
+ memmove((char *) &sin.sin_addr, h->h_addr, sizeof(sin.sin_addr));
+ }
+ else
+ {
+ return NULL;
+ }
sock = -1;
if (strcmp(proto, "udp") == 0)